Migrate urfave/cli to v3 + add manpage subcommand#1969
Migrate urfave/cli to v3 + add manpage subcommand#1969folliehiyuki wants to merge 7 commits intogetsops:mainfrom
manpage subcommand#1969Conversation
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
felixfontein
left a comment
There was a problem hiding this comment.
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?
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 |
|
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.
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
c395aa5 to
8f8fcd7
Compare
|
I rebased onto main branch to resolve the merge conflict. |
8f8fcd7 to
af76152
Compare
|
Hi @felixfontein ! Is there anything I should work on in this PR? It's ready for another review. Rebasing it onto master branch is pretty hard if it gets staled for too long. |
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]>
Signed-off-by: Hoang Nguyen <[email protected]>
Signed-off-by: Hoang Nguyen <[email protected]>
It's already defined as a root command flag. 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]>
af76152 to
902d08d
Compare
|
Sorry, but I'm not sure whether I'll have time anytime soon to look at this in more detail. |
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: