Add default values for all CLI arguments
This commit is contained in:
parent
76ecf500f5
commit
36ef3cf771
|
@ -60,11 +60,11 @@ GITHUB_PAGES_URL=https://gamma-delta.github.io/HexMod
|
|||
Then run these commands to generate the book:
|
||||
```sh
|
||||
# run from the repo root, not doc/
|
||||
hexdoc render doc/properties.toml _site/src/docs
|
||||
hexdoc merge --src _site/src/docs --dst _site/dst/docs
|
||||
hexdoc render
|
||||
hexdoc merge
|
||||
```
|
||||
|
||||
Or, run this command to render the book and start a local web server:
|
||||
```sh
|
||||
hexdoc serve doc/properties.toml --src _site/src/docs --dst _site/dst/docs
|
||||
hexdoc serve --lang en_us
|
||||
```
|
||||
|
|
|
@ -23,17 +23,21 @@ from .utils.sitemap import (
|
|||
load_sitemap,
|
||||
)
|
||||
|
||||
PathArgument = Annotated[Path, typer.Argument()]
|
||||
VerbosityOption = Annotated[int, typer.Option("--verbose", "-v", count=True)]
|
||||
RequiredPathOption = Annotated[Path, typer.Option()]
|
||||
UpdateLatestOption = Annotated[bool, typer.Option(envvar="UPDATE_LATEST")]
|
||||
ReleaseOption = Annotated[bool, typer.Option(envvar="RELEASE")]
|
||||
|
||||
DEFAULT_PROPS_FILE = Path("doc/properties.toml")
|
||||
DEFAULT_MERGE_SRC = Path("_site/src/docs")
|
||||
DEFAULT_MERGE_DST = Path("_site/dst/docs")
|
||||
|
||||
app = typer.Typer(pretty_exceptions_enable=False)
|
||||
|
||||
|
||||
@app.command()
|
||||
def list_langs(
|
||||
props_file: Path,
|
||||
props_file: PathArgument = DEFAULT_PROPS_FILE,
|
||||
*,
|
||||
verbosity: VerbosityOption = 0,
|
||||
):
|
||||
|
@ -46,7 +50,7 @@ def list_langs(
|
|||
|
||||
@app.command()
|
||||
def export(
|
||||
props_file: Path,
|
||||
props_file: PathArgument = DEFAULT_PROPS_FILE,
|
||||
*,
|
||||
lang: Union[str, None] = None,
|
||||
allow_missing: bool = False,
|
||||
|
@ -59,8 +63,8 @@ def export(
|
|||
|
||||
@app.command()
|
||||
def render(
|
||||
props_file: Path,
|
||||
output_dir: Path,
|
||||
props_file: PathArgument = DEFAULT_PROPS_FILE,
|
||||
output_dir: PathArgument = DEFAULT_MERGE_SRC,
|
||||
*,
|
||||
update_latest: UpdateLatestOption = True,
|
||||
release: ReleaseOption = False,
|
||||
|
@ -131,8 +135,8 @@ def render(
|
|||
@app.command()
|
||||
def merge(
|
||||
*,
|
||||
src: RequiredPathOption,
|
||||
dst: RequiredPathOption,
|
||||
src: Path = DEFAULT_MERGE_SRC,
|
||||
dst: Path = DEFAULT_MERGE_DST,
|
||||
update_latest: UpdateLatestOption = True,
|
||||
release: ReleaseOption = False,
|
||||
):
|
||||
|
@ -161,13 +165,13 @@ def merge(
|
|||
|
||||
@app.command()
|
||||
def serve(
|
||||
props_file: Path,
|
||||
props_file: PathArgument = DEFAULT_PROPS_FILE,
|
||||
*,
|
||||
port: int = 8000,
|
||||
src: RequiredPathOption,
|
||||
dst: RequiredPathOption,
|
||||
src: Path = DEFAULT_MERGE_SRC,
|
||||
dst: Path = DEFAULT_MERGE_DST,
|
||||
update_latest: bool = True,
|
||||
release: bool = False,
|
||||
release: bool = True, # you'd generally want --release for development
|
||||
clean: bool = False,
|
||||
lang: Union[str, None] = None,
|
||||
allow_missing: bool = False,
|
||||
|
|
|
@ -38,11 +38,11 @@ GITHUB_PAGES_URL={{ cookiecutter.pages_url }}
|
|||
Then run these commands to generate the book:
|
||||
```sh
|
||||
# run from the repo root, not doc/
|
||||
hexdoc render doc/properties.toml _site/src/docs
|
||||
hexdoc merge --src _site/src/docs --dst _site/dst/docs
|
||||
hexdoc render
|
||||
hexdoc merge
|
||||
```
|
||||
|
||||
Or, run this command to render the book and start a local web server:
|
||||
```sh
|
||||
hexdoc serve doc/properties.toml --src _site/src/docs --dst _site/dst/docs
|
||||
hexdoc serve --lang en_us
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue