-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Comparing changes
Open a pull request
base repository: spf13/cobra
base: v1.7.0
head repository: spf13/cobra
compare: v1.8.1
Commits on Apr 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 284f410 - Browse repository at this point
Copy the full SHA 284f410View commit details
Commits on Jun 12, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 0e3a0bf - Browse repository at this point
Copy the full SHA 0e3a0bfView commit details
Commits on Jun 13, 2023
-
Fix grammar: 'allows to' (#1978)
The use in generated bash completion files is getting flagged by Lintian (the Debian package linting tool). Signed-off-by: Taavi Väänänen <hi@taavi.wtf>
Configuration menu - View commit details
-
Copy full SHA for 2246fa8 - Browse repository at this point
Copy the full SHA 2246fa8View commit details
Commits on Jun 16, 2023
-
test: make fish_completions_test more robust (#1980)
Use temporary files instead of assuming the current directory is writable. Also, if creating a temporary file still returns an error, prevent the test from failing silently by replacing `log.Fatal` with `t.Fatal`.
Configuration menu - View commit details
-
Copy full SHA for 988bd76 - Browse repository at this point
Copy the full SHA 988bd76View commit details
Commits on Jun 19, 2023
-
Configuration menu - View commit details
-
Copy full SHA for fdee73b - Browse repository at this point
Copy the full SHA fdee73bView commit details
Commits on Jun 20, 2023
-
Configuration menu - View commit details
-
Copy full SHA for cbe4865 - Browse repository at this point
Copy the full SHA cbe4865View commit details -
Configuration menu - View commit details
-
Copy full SHA for dcb405a - Browse repository at this point
Copy the full SHA dcb405aView commit details
Commits on Jul 16, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c81c46a - Browse repository at this point
Copy the full SHA c81c46aView commit details
Commits on Jul 18, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 66b215b - Browse repository at this point
Copy the full SHA 66b215bView commit details
Commits on Jul 20, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 60d056d - Browse repository at this point
Copy the full SHA 60d056dView commit details
Commits on Jul 23, 2023
-
Configuration menu - View commit details
-
Copy full SHA for fd865a4 - Browse repository at this point
Copy the full SHA fd865a4View commit details
Commits on Aug 28, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 4955da7 - Browse repository at this point
Copy the full SHA 4955da7View commit details
Commits on Aug 29, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 285460d - Browse repository at this point
Copy the full SHA 285460dView commit details
Commits on Sep 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c5dacb3 - Browse repository at this point
Copy the full SHA c5dacb3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c72800 - Browse repository at this point
Copy the full SHA 0c72800View commit details
Commits on Sep 26, 2023
-
Configuration menu - View commit details
-
Copy full SHA for bd4d165 - Browse repository at this point
Copy the full SHA bd4d165View commit details
Commits on Oct 9, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 95d8a1e - Browse repository at this point
Copy the full SHA 95d8a1eView commit details
Commits on Oct 15, 2023
-
Configuration menu - View commit details
-
Copy full SHA for efe8fa3 - Browse repository at this point
Copy the full SHA efe8fa3View commit details
Commits on Oct 16, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 5c962a2 - Browse repository at this point
Copy the full SHA 5c962a2View commit details
Commits on Oct 22, 2023
-
Allow running persistent run hooks of all parents (#2044)
Currently, only one of the persistent pre-runs and post-runs is executed. It is always the first one found in the parents chain, starting at this command. Expected behavior is to execute all parents' persistent pre-runs and post-runs. Dependent projects implemented various workarounds for this: - manually building persistent hook chains (in every hook). - applying some kind of monkey-patching on top of Cobra. This change eliminates the necessity for such workarounds by allowing to set a global variable EnableTraverseRunHooks. Tickets: - #216 - #252 Signed-off-by: Volodymyr Khoroz <volodymyr.khoroz@foundries.io>
Configuration menu - View commit details
-
Copy full SHA for 4cafa37 - Browse repository at this point
Copy the full SHA 4cafa37View commit details
Commits on Oct 27, 2023
-
When using golangci-lint v1.55.0 some new errors were being reported. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 8b1eba4 - Browse repository at this point
Copy the full SHA 8b1eba4View commit details
Commits on Oct 28, 2023
-
Don't complete --help flag when flag parsing disabled (#2061)
Fixes #2060 When a command sets `DisableFlagParsing = true` it requests the responsibility of doing all the flag parsing. Therefore even the `--help/-f/--version/-v` flags should not be automatically completed by Cobra in such a case. Without this change the `--help/-h/--version/-v` flags can end up being completed twice for plugins: one time from cobra and one time from the plugin (which has set `DisableFlagParsing = true`). Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for b711e87 - Browse repository at this point
Copy the full SHA b711e87View commit details -
Add tests for flag completion registration (#2053)
Different problems have been reported about flag completion registration. These two tests are the cases that were not being verified but had been mentioned as problematic. Ref: - #1320 - #1438 (comment) Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 00b68a1 - Browse repository at this point
Copy the full SHA 00b68a1View commit details
Commits on Oct 29, 2023
-
Replace all non-alphanumerics in active help env var program prefix (#…
…1940) * Replace all non-alphanumerics in active help env var program prefix There are other characters besides the dash that are fine in program names, but are problematic in environment variable names. These include (but are not limited to) period, space, and non-ASCII letters. * Another change in docs to mention non-ASCII-alphanumeric instead of just dash
Configuration menu - View commit details
-
Copy full SHA for 22953d8 - Browse repository at this point
Copy the full SHA 22953d8View commit details
Commits on Oct 30, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 48cea5c - Browse repository at this point
Copy the full SHA 48cea5cView commit details
Commits on Nov 2, 2023
-
Support usage as plugin for tools like kubectl (#2018)
In this case the executable is `kubectl-plugin`, but we run it as: kubectl plugin And the help text should reflect the actual usage of the command. To create a plugin, add the cobra.CommandDisplayNameAnnotation: rootCmd := &cobra.Command{ Use: "plugin", Annotations: map[string]string{ cobra.CommandDisplayNameAnnotation: "kubectl plugin", } } Internally this change modifies CommandPath() for the root command to return the command display name instead of the command name. This is used for error messages, help text generation, and completions. CommandPath() is expected to have spaces and code using it already handle spaces (e.g replacing with _), so hopefully this does not break anything. Fixes: #2017 Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Configuration menu - View commit details
-
Copy full SHA for 890302a - Browse repository at this point
Copy the full SHA 890302aView commit details -
Improve API to get flag completion function (#2063)
The new API is simpler and matches the `c.RegisterFlagCompletionFunc()` API. By removing the global function `GetFlagCompletion()` we are more future proof if we ever move from a global map of flag completion functions to something associated with the command. The commit also makes this API work with persistent flags by using `c.Flag(flagName)` instead of `c.Flags().Lookup(flagName)`. The commit also adds unit tests. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for a0a6ae0 - Browse repository at this point
Copy the full SHA a0a6ae0View commit details
Commits on Nov 13, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 283e32d - Browse repository at this point
Copy the full SHA 283e32dView commit details
Commits on Nov 23, 2023
-
* Avoid redundant string splits There likely isn't actually more than once to split in the source strings in these cases, but avoid doing so anyway as we're only interested in the first. * Avoid redundant completion output target evaluations The target is not to be changed while outputting completions, so resolve it only once. * Avoid redundant active help enablement evaluations The enablement state is not to be changed during completion output, so evaluate it only once. * Preallocate some slices and maps with known size * Avoid some unnecessary looping * Use strings.Builder to construct suggestions
Configuration menu - View commit details
-
Copy full SHA for 3d8ac43 - Browse repository at this point
Copy the full SHA 3d8ac43View commit details
Commits on Dec 12, 2023
-
Update projects_using_cobra.md (#2089)
Add Encore to the list of projects using Cobra
Configuration menu - View commit details
-
Copy full SHA for 236f3c0 - Browse repository at this point
Copy the full SHA 236f3c0View commit details
Commits on Dec 17, 2023
-
Add env variable to suppress completion descriptions on create (#1938)
COBRA_COMPLETION_DESCRIPTIONS=0 or <PROGRAM>_COMPLETION_DESCRIPTIONS=0 can now be used to disable shell completion descriptions.
Configuration menu - View commit details
-
Copy full SHA for e63925d - Browse repository at this point
Copy the full SHA e63925dView commit details
Commits on Dec 18, 2023
-
When using `CommandDisplayNameAnnotation` we want to use it instead of the command name in `--help` message or in the default help command. With current code we get the wrong text in the --help usage text: Flags: -h, --help help for kubectl-plugin And in the long description of the default help command: $ kubectl cobraplugin help -h Help provides help for any command in the application. Simply type kubectl-plugin help [path to command] for full details. The issue was hidden since the test checked only the Usage line. Fixed by extracting a displayName() function and use it when creating FlagSet and when formatting the default help flag usage and the help command long description. Enhance the TestPlugin to check all the lines including the command name.
Configuration menu - View commit details
-
Copy full SHA for df547f5 - Browse repository at this point
Copy the full SHA df547f5View commit details -
Fix help text for runnable plugin command
When creating a plugin without sub commands, the help text included the command name (kubectl-plugin) instead of the display name (kubectl plugin): Usage: kubectl-plugin [flags] The issue is that the usage line for this case does not use the command path but the raw `Use` string, and this case was not tested. Add a test for this case and fix UsageLine() to replace the command name with the display name. Tested using https://github.com/nirs/kubernetes/tree/sample-cli-plugin-help
Configuration menu - View commit details
-
Copy full SHA for a73b9c3 - Browse repository at this point
Copy the full SHA a73b9c3View commit details -
Document how to create a plugin
Using the new CommandDisplayNameAnnotation annotation introduced in Cobra 1.8.0.
Configuration menu - View commit details
-
Copy full SHA for 4122785 - Browse repository at this point
Copy the full SHA 4122785View commit details
Commits on Dec 23, 2023
-
build(deps): bump actions/setup-go from 4 to 5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Configuration menu - View commit details
-
Copy full SHA for c054701 - Browse repository at this point
Copy the full SHA c054701View commit details -
Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 531ce79 - Browse repository at this point
Copy the full SHA 531ce79View commit details -
build(deps): bump actions/labeler from 4 to 5 (#2086)
* build(deps): bump actions/labeler from 4 to 5 Bumps [actions/labeler](https://github.com/actions/labeler) from 4 to 5. - [Release notes](https://github.com/actions/labeler/releases) - [Commits](actions/labeler@v4...v5) --- updated-dependencies: - dependency-name: actions/labeler dependency-type: direct:production update-type: version-update:semver-major ... * Update labeler configuration for v5 Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 199b7ab - Browse repository at this point
Copy the full SHA 199b7abView commit details
Commits on Dec 28, 2023
-
[chore]: update projects using cobra (#2093)
Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Configuration menu - View commit details
-
Copy full SHA for cbcf75e - Browse repository at this point
Copy the full SHA cbcf75eView commit details
Commits on Dec 30, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 0dec88e - Browse repository at this point
Copy the full SHA 0dec88eView commit details
Commits on Jan 6, 2024
-
flags: clarify documentation that LocalFlags related function do not …
…modify the state (#2064)
Configuration menu - View commit details
-
Copy full SHA for 4fb0a66 - Browse repository at this point
Copy the full SHA 4fb0a66View commit details
Commits on Jan 15, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bcfcff7 - Browse repository at this point
Copy the full SHA bcfcff7View commit details
Commits on Mar 8, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bd2655e - Browse repository at this point
Copy the full SHA bd2655eView commit details
Commits on Mar 12, 2024
-
build(deps): bump golangci/golangci-lint-action from 3.7.0 to 4.0.0 (#…
…2108) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.7.0 to 4.0.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v3.7.0...v4.0.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for f34069c - Browse repository at this point
Copy the full SHA f34069cView commit details -
build(deps): bump actions/cache from 3 to 4 (#2102)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for a30cee5 - Browse repository at this point
Copy the full SHA a30cee5View commit details -
Configuration menu - View commit details
-
Copy full SHA for c69ae4c - Browse repository at this point
Copy the full SHA c69ae4cView commit details -
chore: remove repetitive words (#2122)
Signed-off-by: racerole <jiangyifeng@outlook.com>
Configuration menu - View commit details
-
Copy full SHA for 1f80fa2 - Browse repository at this point
Copy the full SHA 1f80fa2View commit details -
fix: remove deprecated io/ioutils package (#2120)
ioutils.ReadAll is deprecated since Go 1.16. This commit replaces it with io.ReadAll. See https://pkg.go.dev/io/ioutil\#ReadAll for reference Issue #2119
Configuration menu - View commit details
-
Copy full SHA for bd914e5 - Browse repository at this point
Copy the full SHA bd914e5View commit details
Commits on Apr 1, 2024
-
* Address gocritic findings, enable it * Enable gosimple, no new findings to address
Configuration menu - View commit details
-
Copy full SHA for 6b5f577 - Browse repository at this point
Copy the full SHA 6b5f577View commit details
Commits on Apr 8, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0fc86c2 - Browse repository at this point
Copy the full SHA 0fc86c2View commit details
Commits on Apr 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 5a1acea - Browse repository at this point
Copy the full SHA 5a1aceaView commit details
There are no files selected for viewing