Repository navigation
fix: explain how to pass an ID that starts with '-' - #62
Merged
Merged
Conversation
Fess IDs are URL-safe Base64, so an ID can start with '-'. The parser
then reads it as options ("No such option: -a"). Passing it after '--'
already works, but nothing outside the skill docs said so.
Every positional ID argument now gets its help text from a shared
id_help() helper that says to give the options first, then '--' and the
ID. README and the troubleshooting reference describe the same form.
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.
Summary
Fess IDs are URL-safe Base64, so an ID can start with
-. Such an ID is read as options:fessctl keymatch update -abcDEF --max-size 3fails withNo such option: -a. Putting the options first and--before the ID (fessctl keymatch update --max-size 3 -- -abcDEF) already works, since that is how Click separates positional arguments from options, but only the skill docs mentioned it, and the error points users at--help, which did not.The commands keep the positional ID;
conventions.mddocuments that no subcommand takes--id, so this PR makes the existing form discoverable instead of adding a second way to pass the ID:id_help()inutils.pyappends "If the ID starts with '-', give the options first, then '--' and the ID." to the help text of every positional ID argument (118 commands, including thedictandscheduler start/stopcommands). Behaviour is unchanged.--form under Usage, andtroubleshooting.mdhas an entry for theNo such option: -aerror.Tests
tests/unit/test_dash_leading_id.py, built from the root Typer app so it covers every command with an ID argument:--helpshows the hint (118 cases, all fail without the change), the--form parses-abcDEFas the ID (118 cases),keymatch updatesends the ID to the API unchanged, and the bare form still fails withNo such option.