Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gvellut committed Jul 8, 2023
1 parent a24fea0 commit 14b1e93
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ The specifig way of setting them will depend on your shell. For example, with Ba
export JNCEP_BYVOLUME=1
```

The names of the environment variables are __case-sensitive__.

### Priority order for option values

The priority order for option values is as follows:
Expand Down Expand Up @@ -384,7 +386,7 @@ Using the `sync`subcommand, `track` will update the list of series tracked by `j
jncep track sync
```

The `--reverse` flag can be used for the opposite: The list of series followed on the J-Novel Club website will be updated to add series that are tracked locally by the `jncep` tool. This can be useful since the Follow functionality of the website has been added just recently and the calendar of the website can be filtered with just the followed series.
The `--reverse` flag can be used for the opposite: The list of series followed on the J-Novel Club website will be updated to add series that are tracked locally by the `jncep` tool.

By default, the `sync` subcommand doesn't do any deletion, it just adds missing entries. To make the list of tracked series and followed series identical, the `--delete` flag can be passed.

Expand Down Expand Up @@ -424,6 +426,10 @@ Options:
-s, --sync Flag to sync tracked series based on series followed
on J-Novel Club and update the new ones from the
beginning of the series
-j, --jnc-managed Flag to indicate whether to use the series followed
on the J-Novel Club website as the tracking
reference for updating (equivalent to running 'track
sync --delete --beginning' followed by 'update')
-w, --whole Flag to indicate whether the whole volume should be
regenerated when a new part is detected during the
update
Expand Down Expand Up @@ -472,13 +478,15 @@ Compared to the `epub` command, the `update` command understands the additional
- USE_EVENTS
- WHOLE
- WHOLE_FINAL
- JNC_MANAGED

Since they are flags, they should have a value like `1`, `true`, `t`, `yes`, `y` or `on` (case insensitive) if set.

They are also available as environment variables:
- JNCEP_USE_EVENTS
- JNCEP_WHOLE
- JNCEP_WHOLE_FINAL
- JNCEP_JNC_MANAGED

### Automation

Expand Down Expand Up @@ -586,6 +594,12 @@ The `set` subcommand can be used to set the value for a configuration option:
jncep config set EMAIL "[email protected]"
```

The option names are case-insensitive so it could also be written as:

```console
jncep config set email "[email protected]"
```

This will display something like:

```console
Expand Down
5 changes: 3 additions & 2 deletions jncep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ def unset_config_option(config, option):


def _validate_option(option):
# keys in upper case when writing
option = option.upper()
allowed_options = list_available_config_options().keys()
if option.upper() not in allowed_options:
if option not in allowed_options:
raise InvalidOptionError(
f"Option '{option}' is not valid. Valid options are: "
f"{', '.join(allowed_options)}"
Expand Down Expand Up @@ -157,5 +158,5 @@ class JNCEPConfigParser(ConfigParser):
def __init__(self):
# TOP_SECTION will be automatically created if new file
super().__init__(default_section=TOP_SECTION, interpolation=None)
# will return the keys in upper case (instead of default lower)
# keys in upper case when reading (instead of default lower)
self.optionxform = lambda x: x.upper()

0 comments on commit 14b1e93

Please sign in to comment.