Skip to content

Commit

Permalink
Add version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kencx committed Jun 27, 2023
1 parent b5de61e commit 05f278b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use it at your own risk.
- Contributions for testing and support on other OS platforms and Calibre versions
are greatly welcome.

calibre-rest is built with Flask and Gunicorn. See [API.md](#API.md) for
calibre-rest is built with Flask and Gunicorn. See [API.md](API.md) for
documentation on all API endpoints.

## Install
Expand Down Expand Up @@ -127,7 +127,20 @@ $ docker compose up -d app
or directly on your local machine:

```console
$ ./app.py
$ python3 ./app.py -h

usage: app.py [options]

Options:
-h, --help show this help message and exit
-d, --dev Start in dev/debug mode
-c, --calibre Path to calibre binary directory
-l, --library Path to calibre library
-u, --username Calibre library username
-p, --password Calibre library password
-b, --bind Bind address HOST:PORT
-g, --log-level Log level
-v, --version Print version
```

calibre-rest can access any local Calibre libraries or remote [Calibre content
Expand All @@ -138,8 +151,6 @@ For the latter, authentication must be enabled and configured.
For more information, refer to the [calibredb
documentation](https://manual.calibre-ebook.com/generated/en/calibredb.html).

See [API.md](API.md) for reference.

### Configuration

The server can be configured with the following environment variables.
Expand Down
11 changes: 9 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import argparse

from calibre_rest import GunicornApp, create_app
from calibre_rest import GunicornApp, __version__, create_app
from config import DevConfig, ProdConfig

if __name__ == "__main__":
Expand All @@ -12,7 +12,7 @@
"--dev",
required=False,
action="store_true",
help="Run dev server",
help="Start in dev/debug mode",
)
parser.add_argument(
"-c",
Expand Down Expand Up @@ -43,8 +43,15 @@
parser.add_argument(
"-b", "--bind", required=False, type=str, help="Bind address HOST:PORT"
)
parser.add_argument(
"-v", "--version", required=False, action="store_true", help="Print version"
)
args = parser.parse_args()

if args.version:
print(__version__)
exit(0)

if args.dev:
app_config = DevConfig(
calibredb=args.calibre,
Expand Down

0 comments on commit 05f278b

Please sign in to comment.