Repository navigation
feat(cli): camelot-py alias, infer --format from --output ext, document the output template - #738
Merged
Merged
Conversation
…e template (camelot-dev#639) Three usability improvements requested in camelot-dev#639 (by @Lucas-C): * Add a 'camelot-py' console script alias matching the PyPI package name, so 'uvx camelot-py …' works without the longer 'uvx --from camelot-py camelot …' invocation. * Make --format optional. When omitted, the format is inferred from the --output path's extension (.csv, .xlsx, .html, .json, .md, .sqlite, etc.). All four flavors share the same inference helper. * Document --output as a *template* in the option help and add a dedicated docs section. The 'name-page-{P}-table-{T}.{ext}' rule has always been there but wasn't documented; surprising new users. Adds a docs section for uvx usage alongside the format-inference and output-template explanations. The fourth request in camelot-dev#639 (options on subcommand: 'camelot lattice --format … filepath') already works as of camelot-dev#614 — no change needed. The fifth request (making 'hybrid' the default flavor) is a behavior change that affects every existing CLI script; deferred for an explicit follow-up issue if there's appetite.
…ev#639 inference The four flavor tests (lattice/stream/hybrid/network) asserted that invoking 'cli subcmd --output <.csv> <pdf>' (no --format) emits the 'Please specify output file format using --format' error. With camelot-dev#639 that error no longer fires for those calls — the format is inferred from the .csv extension and the parse succeeds. For each subcommand: - swap the failure assertion for a 'Found N tables' success assertion, documenting the new inference behaviour - (lattice only) add an extra invocation with a .ext-less --output path to confirm the format error STILL fires when the extension is unknown, locking in the fallback semantics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #639.
Three usability improvements requested by @Lucas-C in #639:
camelot-pyscript aliasuvx camelot-py …now works directly.camelot-pyis an alias for the same entry point ascamelot— matches the PyPI package name, so users don't have to remember the longeruvx --from camelot-py camelot …form.--formatinferred from--outputextension--formatis now optional. Each subcommand calls a shared_infer_format(output, explicit)helper that:--format(no behaviour change).--outputextension to a known format (.csv/.xlsx/.xls/.html/.htm/.json/.md/.markdown/.sqlite/.sqlite3/.db).None, falling through to the existing "specify --format" error.So this works:
--outputdocumented as a templateThe
name-page-{P}-table-{T}.{ext}rule was always there but undocumented; surprising for new users. The option help now says so explicitly, and a dedicated docs section indocs/user/cli.rstshows the produced file pattern with a worked example.What I deliberately did NOT do
camelot lattice --output … file.pdfshape: options on the subcommand) already works as of Feat: Make CLI options position-independent #614. No change needed.hybridthe default flavor) is a behaviour change that affects every existing CLI script. Deferred for an explicit follow-up issue if there's appetite — that one is not small.Thanks @Lucas-C for the focused feedback.