refactor(cli): replace positional input argument with --input / -i flag
This commit is contained in:
parent
ecdd28e8a3
commit
715e0988dc
3 changed files with 9 additions and 8 deletions
BIN
.coverage
BIN
.coverage
Binary file not shown.
12
AGENTS.md
12
AGENTS.md
|
|
@ -53,22 +53,22 @@ Do **not** use `pip` or `python` directly.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Print CSV to stdout (date defaults to today)
|
# Print CSV to stdout (date defaults to today)
|
||||||
uv run timesheets input.md
|
uv run timesheets --input input.md
|
||||||
|
|
||||||
# Write CSV to a file
|
# Write CSV to a file
|
||||||
uv run timesheets input.md -o output.csv
|
uv run timesheets --input input.md -o output.csv
|
||||||
|
|
||||||
# Override the date (DD/MM/YY)
|
# Override the date (DD/MM/YY)
|
||||||
uv run timesheets input.md --date 22/05/26
|
uv run timesheets --input input.md --date 22/05/26
|
||||||
|
|
||||||
# Use a specific project map file
|
# Use a specific project map file
|
||||||
uv run timesheets input.md --map /path/to/project_map.json
|
uv run timesheets --input input.md --map /path/to/project_map.json
|
||||||
|
|
||||||
# Print a human-readable summary instead of CSV
|
# Print a human-readable summary instead of CSV
|
||||||
uv run timesheets input.md --summary
|
uv run timesheets --input input.md --summary
|
||||||
|
|
||||||
# Read from stdin
|
# Read from stdin
|
||||||
cat input.md | uv run timesheets -
|
cat input.md | uv run timesheets --input -
|
||||||
|
|
||||||
# Fetch today's entries from Joplin (token via env var)
|
# Fetch today's entries from Joplin (token via env var)
|
||||||
JOPLIN_TOKEN=your_token uv run timesheets --joplin
|
JOPLIN_TOKEN=your_token uv run timesheets --joplin
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@ def build_parser() -> argparse.ArgumentParser:
|
||||||
|
|
||||||
source = parser.add_mutually_exclusive_group(required=True)
|
source = parser.add_mutually_exclusive_group(required=True)
|
||||||
source.add_argument(
|
source.add_argument(
|
||||||
"input",
|
"--input",
|
||||||
nargs="?",
|
"-i",
|
||||||
help="Path to the markdown file containing the timesheet table, or '-' to read from stdin.",
|
help="Path to the markdown file containing the timesheet table, or '-' to read from stdin.",
|
||||||
|
default=None,
|
||||||
)
|
)
|
||||||
source.add_argument(
|
source.add_argument(
|
||||||
"--joplin",
|
"--joplin",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue