-
Notifications
You must be signed in to change notification settings - Fork 976
Migrate urfave/cli to v3 + add manpage subcommand
#1969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Hoang Nguyen <[email protected]>
to match the underlying cli.Exit() function it calls. Signed-off-by: Hoang Nguyen <[email protected]>
Signed-off-by: Hoang Nguyen <[email protected]>
af6fba9 to
c2ce957
Compare
|
I noticed that urfave/cli v3 removed a hidden builtin feature to generate CLI documentation and put it into a separated Go package. Even though this is a bit out of scope for this PR, I added another commit to include a subcommand to generate man page for sops. |
manpage subcommand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last time I did investigated github.com/urfave/cli/v3 it was processing arguments sufficiently different that this would be a breaking change for the CLI interface of SOPS, since it parses some things quite differently, and thus not acceptable. Is there now some compatibility mode with v1? Or is this PR a breaking change?
Signed-off-by: Hoang Nguyen <[email protected]>
655c455 to
0f1cc3e
Compare
Can you explain the behavior? Here is some differences I spotted:
Apart from those, I don't see anything strange (yet). I only use a small subset of sops' functionalities, so I haven't tested every subcommand. Whether the above changes are breaking or not is up to you. Personally it doesn't affect my daily usage. |
|
There are also differences in how |
Signed-off-by: Hoang Nguyen <[email protected]>
With this change, we don't need the Go template hack anymore. The help text for subcommands displays correctly without showing global options. Signed-off-by: Hoang Nguyen <[email protected]>
It's already defined as a root command flag. Signed-off-by: Hoang Nguyen <[email protected]>
|
Even with I opened urfave/cli#2208 as I don't know whether this is an intended behavior. |
| Sources: cli.EnvVars("SOPS_DECRYPTION_ORDER"), | ||
| }, | ||
| }, keyserviceFlags...), | ||
| // Repeat keyserviceFlags, with Local value set to true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was tempted to inject Local = true into all global flags after they are defined, but the approach seems to be messy, and we probably will need to wrap the slice elements with a custom interface. Every global flag is defined plainly here, even with a level of duplication, for simplicity.
Ref: urfave/cli#2073
The main motivation of this PR is better support for shell completion. We won't need to maintain custom completion scripts, while having additional support for fish shell and powershell.
References: