Add command line argument to print version

This commit is contained in:
Michael Lazar 2019-09-22 20:36:57 -04:00
parent 371b7dd01d
commit 378d58a502
2 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,8 @@
### Unreleased ### Unreleased
-
- Added ``-V`` / ``--version`` argument to display the version and exit.
- Force URLs to always end in trailing slashes when serving a directory. This - Force URLs to always end in trailing slashes when serving a directory. This
reduces duplicate selectors and makes resolving relative links more reliable. reduces duplicate selectors and makes resolving relative links more reliable.

View File

@ -616,6 +616,9 @@ def command_line_parser() -> argparse.ArgumentParser:
description="An Experimental Gemini Protocol Server", description="An Experimental Gemini Protocol Server",
formatter_class=argparse.ArgumentDefaultsHelpFormatter, formatter_class=argparse.ArgumentDefaultsHelpFormatter,
) )
parser.add_argument(
"-V", "--version", action="version", version="jetforce " + __version__
)
parser.add_argument("--host", help="Server address to bind to", default="127.0.0.1") parser.add_argument("--host", help="Server address to bind to", default="127.0.0.1")
parser.add_argument("--port", help="Server port to bind to", type=int, default=1965) parser.add_argument("--port", help="Server port to bind to", type=int, default=1965)
parser.add_argument("--hostname", help="Server hostname", default="localhost") parser.add_argument("--hostname", help="Server hostname", default="localhost")