Search is not available for this dataset
hash
string
author
int32
committer_date
string
timezone
int64
parents
string
message
string
changes
string
language
string
25bab5a3982e8b0c301a9d63b2999bbd34d360c6
134
2021-12-07 16:00:50-07:00
-32,400
['3fed3ef5adf9fa1cfff46b6860850828d6c60154']
Fix invalid shell completion when used with ~/.cobra.yaml (#1510) `cobra completion` outputs invalid output "Using config file:" at the top of the completion script. when ~/.cobra.yaml exists.
[{'old_path': 'cobra/cmd/root.go', 'new_path': 'cobra/cmd/root.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -74,6 +74,6 @@ func initConfig() {\n \tviper.AutomaticEnv()\n \n \tif err := viper.ReadInConfig(); err == nil {\n-\t\tfmt.Println("Using config file:", viper.ConfigFileUsed())\n+\t\tfmt.Fprintln(os.Stde...
Go
ee75a2b1edeb8001c4b7e36edcf2768479abffe6
480
2021-12-07 16:01:22-07:00
-3,600
['25bab5a3982e8b0c301a9d63b2999bbd34d360c6']
Remove trailing spaces from bash completion command description (#1520)
[]
Go
6f84ef48750fe6355a267117837ba6ee3da254e7
449
2021-12-07 16:02:02-07:00
18,000
['ee75a2b1edeb8001c4b7e36edcf2768479abffe6']
Provide option to hide default 'completion' cmd (#1541) Fixes #1507 Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -93,6 +93,8 @@ type CompletionOptions struct {\n \t// DisableDescriptions turns off all completion descriptions for shells\n \t// that support them\n \tDisableDescriptions bool\n+\t// HiddenDefaultCmd makes t...
Go
1beb476da9b46aef65cc176d683f4278cb944085
194
2021-12-07 16:03:24-07:00
-28,800
['6f84ef48750fe6355a267117837ba6ee3da254e7']
fix: Duplicate error message from cobra init boilerplates (#1463)
[{'old_path': 'cobra/tpl/main.go', 'new_path': 'cobra/tpl/main.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -67,7 +67,10 @@ to quickly create a Cobra application.` + "`" + `,\n // Execute adds all child commands to the root command and sets flags appropriately.\n // This is called by main.main(). It only need...
Go
ff2c55e32312d66f6898ed3f2b48a654b94a207c
492
2021-12-07 16:06:09-07:00
-3,600
['1beb476da9b46aef65cc176d683f4278cb944085']
chore(ci): use golangci-lint-action (#1477) Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
[{'old_path': '.github/workflows/Test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.RENAME: 3>, 'diff': '@@ -9,6 +9,20 @@ env:\n \n jobs:\n \n+ golangci-lint:\n+ runs-on: ubuntu-latest\n+ steps:\n+\n+ - uses: actions/setup-go@v2\n+ with:\n+ go-version: \'1.17\'\n+...
Go
1854bb5c96beeb559b85af56b09ea50a463280a0
613
2021-12-07 16:06:52-07:00
-3,600
['ff2c55e32312d66f6898ed3f2b48a654b94a207c']
Fix some typos (mostly found by codespell) (#1514) Signed-off-by: Stefan Weil <sw@weilnetz.de>
[{'old_path': 'command_test.go', 'new_path': 'command_test.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -1414,16 +1414,16 @@ func TestPersistentHooks(t *testing.T) {\n \t\tname string\n \t\tgot string\n \t}{\n-\t\t// TODO: currently PersistenPreRun* defined in parent does not\n-\t\t// run if the matchin chil...
Go
36bff0a4d54129f4d26b47f6700829f8ac652f19
41
2021-12-07 16:24:06-07:00
0
['1854bb5c96beeb559b85af56b09ea50a463280a0']
fix root.go.golden (#1552)
[{'old_path': 'cobra/cmd/testdata/root.go.golden', 'new_path': 'cobra/cmd/testdata/root.go.golden', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -43,7 +43,10 @@ to quickly create a Cobra application.`,\n // Execute adds all child commands to the root command and sets flags appropriately.\n // This is called by mai...
Go
19c9c7438498bf4ba07506b4eaa76670cd37ae2d
386
2021-12-09 14:47:27-07:00
25,200
['01e05b8ea13c594aecf11fcdf5da065dce51de5e']
Always include the os package import when generating the root command (#1557) Signed-off-by: John McBride <jmcbride@vmware.com>
[{'old_path': 'cobra/tpl/main.go', 'new_path': 'cobra/tpl/main.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -37,9 +37,9 @@ package cmd\n \n import (\n {{- if .Viper }}\n-\t"fmt"\n+\t"fmt"{{ end }}\n \t"os"\n-{{ end }}\n+\n \t"github.com/spf13/cobra"\n {{- if .Viper }}\n \t"github.com/spf13/viper"{{ end }}\n'}...
Go
9054739e08187aab9294b7a773d54c92fabc23d3
449
2021-12-14 11:22:22-07:00
18,000
['19c9c7438498bf4ba07506b4eaa76670cd37ae2d']
Remove __complete cmd for program without subcmds (#1563) Fixes #1562 Programs that don't have sub-commands can accept any number of args. However, when doing shell completion for such programs, within the __complete code this very __complete command makes it that the program suddenly has a sub-command, and the ...
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -228,7 +228,17 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi\n \tif c.Root().TraverseChildren {\n \t\tfinalCmd, finalArgs, err = c.Root().Traverse(trimmedArgs)\n \t} else...
Go
e04ec725508c760e70263b031e5697c232d5c3fa
349
2022-01-06 13:58:09-07:00
28,800
['cb9d7b1cec87c2bb005c6e2790553bcd629bc542']
Bump license year to 2022 in golden files (#1575)
[{'old_path': 'cobra/cmd/testdata/main.go.golden', 'new_path': 'cobra/cmd/testdata/main.go.golden', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -1,5 +1,5 @@\n /*\n-Copyright © 2021 NAME HERE <EMAIL ADDRESS>\n+Copyright © 2022 NAME HERE <EMAIL ADDRESS>\n \n Licensed under the Apache License, Version 2.0 (the "Lice...
Go
7cabfeb8f837c7bd5b834f4fbe98fdef1136465a
453
2022-02-16 15:17:17-07:00
-3,600
['e04ec725508c760e70263b031e5697c232d5c3fa']
Update Go Doc link and badge (#1593) Use `pkg.go.dev` instead of `godoc.org`
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -7,7 +7,7 @@ Cobra is used in many Go projects such as [Kubernetes](http://kubernetes.io/),\n name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra.\n \n [![](https:/...
Go
a5996323794c96a0d14df49f6675708a87e53b98
86
2022-02-17 10:17:44-07:00
-3,600
['7cabfeb8f837c7bd5b834f4fbe98fdef1136465a']
Fix install command (#1576)
[{'old_path': 'cobra/README.md', 'new_path': 'cobra/README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -3,7 +3,7 @@\n Cobra provides its own program that will create your application and add any\n commands you want. It's the easiest way to incorporate Cobra into your application.\n \n-Install the cobra gener...
Go
6d2dc43606da38b673801b8f678c7e5143dfad58
354
2022-02-24 14:51:17-05:00
28,800
['a5996323794c96a0d14df49f6675708a87e53b98']
Add Pixie to projects. (#1581)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -35,6 +35,7 @@\n - [OpenShift](https://www.openshift.com/)\n - [Ory Hydra](https://github.com/ory/hydra)\n - [Ory Kratos](https://github.com/ory/kratos)\n+- [Pixie](https://github.com/pixie-...
Go
8267283cfe84768a0ec01b29b981f37e2ea99299
449
2022-02-28 08:24:45-07:00
18,000
['6d2dc43606da38b673801b8f678c7e5143dfad58']
Add MAINTAINERS file (alphabetical order) (#1545) This should help the community know who they can turn to, but also give credit to the maintainers for all their hard work. Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
[{'old_path': None, 'new_path': 'MAINTAINERS', 'type': <ModificationType.ADD: 1>, 'diff': '@@ -0,0 +1,13 @@\n+maintainers:\n+- spf13\n+- johnSchnake\n+- jpmcb\n+- marckhouzam\n+inactive:\n+- anthonyfok\n+- bep\n+- bogem\n+- broady\n+- eparis\n+- jharshman\n+- wfernandes\n'}]
Go
e1b831e5c2a1639f3bba57d0922fd0c7a7816df7
386
2022-03-08 17:10:09-07:00
25,200
['8267283cfe84768a0ec01b29b981f37e2ea99299']
Updates labeler for new labels (#1613) Signed-off-by: John McBride <jmcbride@vmware.com>
[{'old_path': '.github/labeler.yml', 'new_path': '.github/labeler.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -1,16 +1,17 @@\n # changes to documentation generation\n-"area/doc-gen": doc/**/*\n+"area/docs-generation": doc/**/*\n \n-# changes to the core Go cobra lib package\n-"area/lib": ./*.go\n+# changes ...
Go
5b2b9e9f61d36ccb66167301f76a2292c3729855
386
2022-03-10 08:19:35-07:00
25,200
['9369465955fcc766aed3e7cf574277ee553251d4']
Removes viper dependency by removing cobra/ CLI tool (#1604) The cobra bootstrapping CLI tool has moved to https://github.com/spf13/cobra-cli Signed-off-by: John McBride <jmcbride@vmware.com>
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -61,7 +61,7 @@ jobs:\n go install github.com/kyoh86/richgo"${_version}"\n go install github.com/mitchellh/gox"${_version}"\n \n- - run: PATH=$HOME/go/bin/:$PATH make...
Go
81d27c8f8d2ec777e696a9bc06980264ea3bca00
365
2022-03-14 07:05:53-04:00
-28,800
['5b2b9e9f61d36ccb66167301f76a2292c3729855']
fix some typos (#1625) * fix some typos Signed-off-by: cuishuang <imcusg@gmail.com>
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -312,7 +312,7 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi\n \tvar directive ShellCompDirective\n \n \t// Note that we want to perform flagname completion even if finalC...
Go
37463cff2c1154de0fd403bff18957f8b1b7e3e4
404
2022-03-16 09:34:01-06:00
18,000
['81d27c8f8d2ec777e696a9bc06980264ea3bca00']
Remove CHANGELOG.md as it isn't updated (#1634) Fixes #1442 Signed-off-by: John Schnake <jschnake@vmware.com>
[{'old_path': 'CHANGELOG.md', 'new_path': None, 'type': <ModificationType.DELETE: 4>, 'diff': '@@ -1,51 +0,0 @@\n-# Cobra Changelog\n-\n-## v1.1.3\n-\n-* **Fix:** release-branch.cobra1.1 only: Revert "Deprecate Go < 1.14" to maintain backward compatibility\n-\n-## v1.1.2\n-\n-### Notable Changes\n-\n-* Bump license yea...
Go
65b1195d6edf289395c16f3d98670b163d1d16f7
41
2022-03-17 06:26:10-04:00
0
['37463cff2c1154de0fd403bff18957f8b1b7e3e4']
ci: test on Golang 1.18 (#1635)
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -36,6 +36,7 @@ jobs:\n - 15\n - 16\n - 17\n+ - 18\n name: \'${{ matrix.platform }} | 1.${{ matrix.go }}.x\'\n runs-on: ${{ matrix.platform }}-lat...
Go
8cc7be21194f770e16afd51c2b0eec11b97bcd2d
520
2022-03-17 17:55:16-04:00
-3,600
['65b1195d6edf289395c16f3d98670b163d1d16f7']
feat: Add how to load completions in your current zsh session (#1608)
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -669,6 +669,10 @@ to enable it. You can execute the following once:\n \n \techo "autoload -U compinit; compinit" >> ~/.zshrc\n \n+To load completions in your current shell session:\n+\n+\tsource <(%[1]s comp...
Go
94e552d8d69cdf5460ec7b2b5da63199c15f33f8
449
2022-03-17 21:36:47-04:00
14,400
['8cc7be21194f770e16afd51c2b0eec11b97bcd2d']
Add backwards-compatibility tests for legacyArgs() (#1547) These tests make sure we don't break backwards-compatibility with respect to the current behaviour of legacyArgs(). See #1500 for the back-story. Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
[{'old_path': 'args_test.go', 'new_path': 'args_test.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -292,3 +292,32 @@ func TestMatchAll(t *testing.T) {\n \t\t})\n \t}\n }\n+\n+// This test make sure we keep backwards-compatibility with respect\n+// to the legacyArgs() function.\n+// It makes sure the root comma...
Go
5d066b77b522ad02084723a79b618243cd6f47e3
252
2022-03-17 21:37:54-04:00
-3,600
['94e552d8d69cdf5460ec7b2b5da63199c15f33f8']
Introduce FixedCompletions (#1574) Example usage: choices := []string{"choice1", "choice2", "choice3"} cmd.RegisterFlagCompletionFunc(cobra.FixedCompletions(choices, ShellCompDirectiveNoFileComp))
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -103,6 +103,14 @@ func NoFileCompletions(cmd *Command, args []string, toComplete string) ([]string\n \treturn nil, ShellCompDirectiveNoFileComp\n }\n \n+// FixedCompletions can be used to create a completion ...
Go
f848943afd7212766aadc19256cf9e7384980281
27
2022-03-18 06:01:58-04:00
-39,600
['5d066b77b522ad02084723a79b618243cd6f47e3']
Add Command.SetContext (#1551) Increases flexibility in how Contexts can be used with Cobra.
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -230,6 +230,12 @@ func (c *Command) Context() context.Context {\n \treturn c.ctx\n }\n \n+// SetContext sets context for the command. It is set to context.Background by default and will be overwritten by\n+// Command...
Go
3a1795bc253b686e565770630a78baee3e7ae7f4
66
2022-03-21 13:35:35-04:00
-3,600
['f848943afd7212766aadc19256cf9e7384980281']
Fix Command.Context comment (#1639)
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -224,8 +224,13 @@ type Command struct {\n \tSuggestionsMinimumDistance int\n }\n \n-// Context returns underlying command context. If command wasn't\n-// executed with ExecuteContext Context returns Background contex...
Go
03c3eb73f8d00531742e232eb311f8cce0cd6225
74
2022-03-21 13:44:18-04:00
-19,800
['3a1795bc253b686e565770630a78baee3e7ae7f4']
Add Kubescape to projects (#1642)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -22,6 +22,7 @@\n - [Istio](https://istio.io)\n - [Kool](https://github.com/kool-dev/kool)\n - [Kubernetes](http://kubernetes.io/)\n+- [Kubescape](https://github.com/armosec/kubescape)\n - [L...
Go
d622355c84521e1820d05a0c763b7997e40c36c4
75
2022-03-24 19:20:54-04:00
-19,800
['03c3eb73f8d00531742e232eb311f8cce0cd6225']
Changed branch name in the cobra generator link to 'main' (#1645)
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -102,7 +102,7 @@ It can be installed by running:\n go install github.com/spf13/cobra-cli@latest\n ```\n \n-For complete details on using the Cobra-CLI generator, please read [The Cobra Generator README](https://github....
Go
ab42c937ec7c62b0345f61c3e950cb785a470dc7
386
2022-03-29 16:56:24-06:00
21,600
['52e6099aead5c377be3c46f34bf0c2d3e0c128b6']
Adds size labeler GitHub action (#1610) Signed-off-by: John McBride <jmcbride@vmware.com>
[{'old_path': None, 'new_path': '.github/workflows/size-labeler.yml', 'type': <ModificationType.ADD: 1>, 'diff': "@@ -0,0 +1,28 @@\n+# Reference: https://github.com/CodelyTV/pr-size-labeler\n+\n+name: size-labeler\n+\n+on: [pull_request_target]\n+\n+jobs:\n+ size-labeler:\n+ runs-on: ubuntu-latest\n+ name: Label...
Go
5271cf43427f43a0815f460bd80ab86e5aebc708
41
2022-03-29 20:05:24-04:00
-3,600
['ab42c937ec7c62b0345f61c3e950cb785a470dc7']
ci/test: RICHGO_FORCE_COLOR (#1647)
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -62,7 +62,7 @@ jobs:\n go install github.com/kyoh86/richgo"${_version}"\n go install github.com/mitchellh/gox"${_version}"\n \n- - run: PATH=$HOME/go/bin/:$PATH make...
Go
9d15fe657a500065fb343f8a9d1474582147f828
386
2022-04-08 11:46:22-06:00
21,600
['5271cf43427f43a0815f460bd80ab86e5aebc708']
Update stale-bot (#1609) - Only label issues after feb 01, 2022 - Apply lifecycle/stale after 60 days - Close issue and apply lifecycle/rotten after another 30 days Signed-off-by: John McBride <jmcbride@vmware.com>
[{'old_path': '.github/workflows/stale.yml', 'new_path': '.github/workflows/stale.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -13,9 +13,38 @@ jobs:\n - uses: actions/stale@v5\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n- stale-issue-message: \'This issue is being marked as st...
Go
bf6cb5804d7a45faacd0abfc99145c42696ec818
529
2022-04-14 00:30:27-04:00
25,200
['9d15fe657a500065fb343f8a9d1474582147f828']
Wrap printf tab with quotes (#1665) Without this, slightly older versions of zsh fail to correctly parse the output of the __complete command. Tested that with zsh 5.0.2 and zsh 5.8. Since this is just correctly quoting the output of a command, it shouldn't cause any compatibility issues.
[{'old_path': 'zsh_completions.go', 'new_path': 'zsh_completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -171,7 +171,7 @@ _%[1]s()\n # We first need to escape any : as part of the completion itself.\n comp=${comp//:/\\\\:}\n \n- local tab=$(printf \'\\t\')\n+ ...
Go
68b6b24f0c9926a779f7113d1040396a30fdedaf
404
2022-04-17 16:04:57-05:00
18,000
['bf6cb5804d7a45faacd0abfc99145c42696ec818']
Add ability to mark flags as required or exclusive as a group (#1654) This change adds two features for dealing with flags: - requiring flags be provided as a group (or not at all) - requiring flags be mutually exclusive of each other By utilizing the flag annotations we can mark which flag groups a flag is a ...
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -863,6 +863,10 @@ func (c *Command) execute(a []string) (err error) {\n \tif err := c.validateRequiredFlags(); err != nil {\n \t\treturn err\n \t}\n+\tif err := c.validateFlagGroups(); err != nil {\n+\t\treturn err\n...
Go
89d7b832c7879159ada237e9a528177200f35481
488
2022-04-20 10:23:27-04:00
-7,200
['68b6b24f0c9926a779f7113d1040396a30fdedaf']
Add Polygon Edge as a project using Cobra (#1672)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -37,6 +37,7 @@\n - [Ory Hydra](https://github.com/ory/hydra)\n - [Ory Kratos](https://github.com/ory/kratos)\n - [Pixie](https://github.com/pixie-io/pixie)\n+- [Polygon Edge](https://github....
Go
d8184d32696bee36f682bcb3ace5642af54cd7ad
264
2022-04-26 20:39:55-04:00
25,200
['b9460ccc12f650b6df2f1a75d79a279ecf219281']
Fix typo sh completion docs (#1678)
[{'old_path': 'shell_completions.md', 'new_path': 'shell_completions.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -122,7 +122,7 @@ For example, if you want `kubectl get [tab][tab]` to show a list of valid "nouns\n Some simplified code from `kubectl get` looks like:\n \n ```go\n-validArgs []string = { "pod", "...
Go
2722a75ba3dcf846d3b14f62a2c69a5478f7feb3
646
2022-04-27 22:02:30-04:00
-10,800
['d8184d32696bee36f682bcb3ace5642af54cd7ad']
perf(bash-v2): use backslash escape string expansion for tab (#1682) Using a command substitution, i.e. a subshell, with `printf` is expensive for this purpose. For example `__*_format_comp_descriptions` is run once for each completion candidate; the expense adds up and shows when there are a lot of them.
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -154,8 +154,7 @@ __%[1]s_handle_completion_types() {\n # If the user requested inserting one completion at a time, or all\n # completions at once on the command-line we must remo...
Go
4f0facbcee0aadb87179d3fed80e92709de491a9
646
2022-04-27 22:27:52-04:00
-10,800
['2722a75ba3dcf846d3b14f62a2c69a5478f7feb3']
style(bash-v2): out is not an array variable, do not refer to it as such (#1681) Even though this to my surprise works, it doesn't accomplish anything but some confusion. Remove it.
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -78,7 +78,7 @@ __%[1]s_get_completion_results() {\n directive=0\n fi\n __%[1]s_debug "The completion directive is: ${directive}"\n- __%[1]s_debug "The completions are: ${out[*...
Go
09d6ba690f83d8efe2d5eca1e74897e123075d2a
647
2022-05-02 21:00:51-04:00
-10,800
['4f0facbcee0aadb87179d3fed80e92709de491a9']
perf(bash-v2): standard completion optimizations (#1683) Refactor to remove two loops over the entire list of candidates. Format descriptions only for completions that are actually going to be displayed, instead of for all candidates. Format descriptions inline in completions array, removing need for a command...
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -177,40 +177,28 @@ __%[1]s_handle_standard_completion_case() {\n local tab=$\'\\t\' comp\n \n local longest=0\n+ local compline\n # Look for the longest completion so that we can ...
Go
f17e5a27c96e668f58c4607222d4e3dffc480bc1
647
2022-05-02 21:41:07-04:00
-10,800
['09d6ba690f83d8efe2d5eca1e74897e123075d2a']
style(bash): out is not an array variable, do not refer to it as such (#1684) For legacy bash completions, similarly as commit 4f0facbcee0aadb87179d3fed80e92709de491a9 is for bash completions v2. As a side effect, fixes test suite with shellcheck 0.8.0 installed; apparently the 0.7.0 that's in GitHub Actions' ubu...
[{'old_path': 'bash_completions.go', 'new_path': 'bash_completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -99,7 +99,7 @@ __%[1]s_handle_go_custom_completion()\n directive=0\n fi\n __%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"\n- __%[1]s_debug "${FUNCNAME[0]...
Go
95d7df18589543fc4a0c62a4734349811a2ddcec
647
2022-05-03 21:16:07-04:00
-10,800
['f17e5a27c96e668f58c4607222d4e3dffc480bc1']
perf(bash-v2): short-circuit descriptionless candidate lists (#1686) If the list of candidates has no descriptions, short circuit all the description processing logic, basically just do a `compgen -W` for the whole list and be done with it. We could conceivably do some optimizations like this and more when gener...
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -176,6 +176,14 @@ __%[1]s_handle_completion_types() {\n __%[1]s_handle_standard_completion_case() {\n local tab=$\'\\t\' comp\n \n+ # Short circuit to optimize if we don\'t have descripti...
Go
fb8031162c2ffab270774f13c6904bb04cbba5a7
647
2022-05-03 21:34:55-04:00
-10,800
['95d7df18589543fc4a0c62a4734349811a2ddcec']
perf(bash-v2): speed up filtering entries with descriptions (#1689) Use simple prefix match instead of single word `compgen -W` command substitution for each candidate match.
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -191,8 +191,7 @@ __%[1]s_handle_standard_completion_case() {\n # Strip any description before checking the length\n comp=${compline%%%%$tab*}\n # Only consider the comple...
Go
9e88759b19cd358e9af6f0d778b9a23990cf7f51
647
2022-05-04 16:23:02-04:00
-10,800
['fb8031162c2ffab270774f13c6904bb04cbba5a7']
perf(bash-v2): speed up filtering menu-complete descriptions (#1692) Similarly as fb8031162c2ffab270774f13c6904bb04cbba5a7 (+ the empty entry fix) did for the "regular", non-menu completion cases.
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -156,11 +156,11 @@ __%[1]s_handle_completion_types() {\n # https://github.com/spf13/cobra/issues/1508\n local tab=$\'\\t\' comp\n while IFS=\'\' read -r comp; do\n+ ...
Go
25f5bb5f9702a947581857f29b1deab5a6dee921
355
2022-05-14 14:10:36-06:00
-7,200
['9e88759b19cd358e9af6f0d778b9a23990cf7f51']
Prefer ReplaceAll instead of Replace(..., -1) (#1530)
[{'old_path': 'bash_completions.go', 'new_path': 'bash_completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -387,7 +387,7 @@ __%[1]s_handle_word()\n }\n \n func writePostscript(buf io.StringWriter, name string) {\n-\tname = strings.Replace(name, ":", "__", -1)\n+\tname = strings.ReplaceAll(name, ":", "__"...
Go
e1ded5cd9480aa9921a8cb0f646b6b569ac1b9d8
647
2022-05-17 13:47:47-04:00
-10,800
['8afe9d1b56f1c876f8f56ea91f838a30e01563de']
fix(bash-v2): skip empty completions when filtering descriptions (#1691) `read` gives a last null value following a trailing newline. Regression from fb8031162c2ffab270774f13c6904bb04cbba5a7.
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -188,6 +188,7 @@ __%[1]s_handle_standard_completion_case() {\n local compline\n # Look for the longest completion so that we can format things nicely\n while IFS='' read -r compline;...
Go
ffa8860dbe017851bc4e8ff4fb2b6249cfc1e4d8
191
2022-05-17 14:28:13-04:00
-7,200
['e1ded5cd9480aa9921a8cb0f646b6b569ac1b9d8']
Change links from http:// to https:// (#1695)
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -2,7 +2,7 @@\n \n Cobra is a library for creating powerful modern CLI applications.\n \n-Cobra is used in many Go projects such as [Kubernetes](http://kubernetes.io/),\n+Cobra is used in many Go projects such as [Kuber...
Go
5b11656e45a6a6579298a3b28c71f456ff196ad6
647
2022-05-17 20:57:08-04:00
-10,800
['ffa8860dbe017851bc4e8ff4fb2b6249cfc1e4d8']
perf(bash-v2): read directly to COMPREPLY on descriptionless short circuit (#1700) Not that it'd really matter that much performancewise given the level we are at for this case, but this change makes the short circuit roughly twice as fast on my box as it was for the 1000 rounds done in marckhouzam/cobra-completion...
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -178,9 +178,7 @@ __%[1]s_handle_standard_completion_case() {\n \n # Short circuit to optimize if we don\'t have descriptions\n if [[ $out != *$tab* ]]; then\n- while IFS=\'\' read...
Go
37d481d4d40a07b1a8f2f6c345124540e870c85c
642
2022-06-05 15:45:59-04:00
-7,200
['5b11656e45a6a6579298a3b28c71f456ff196ad6']
fix: Don't complete _command on zsh (#1690) Previously the generated zsh completion script started with the line #compdef _<command> <command> where <command> is the command that the zsh completion script is generated for. This enabled completions for both <command> and _<command>, but _<command> is the...
[{'old_path': 'zsh_completions.go', 'new_path': 'zsh_completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -75,7 +75,7 @@ func genZshComp(buf io.StringWriter, name string, includeDesc bool) {\n \tif !includeDesc {\n \t\tcompCmd = ShellCompNoDescRequestCmd\n \t}\n-\tWriteStringAndCheck(buf, fmt.Sprintf(`#co...
Go
ca8e3c2779b8cc6168ab6ffdf9c1f2ac65652404
362
2022-06-08 17:12:54-04:00
25,200
['37d481d4d40a07b1a8f2f6c345124540e870c85c']
Add Pulumi as a project using cobra (#1720) * Add Pulumi as a project using cobra
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -41,6 +41,7 @@\n - [Pouch](https://github.com/alibaba/pouch)\n - [ProjectAtomic (enterprise)](https://www.projectatomic.io/)\n - [Prototool](https://github.com/uber/prototool)\n+- [Pulumi](h...
Go
87ea1807f71dfa4d0bd7058c099b3978b128aea6
371
2022-06-12 22:22:49-04:00
-28,800
['ca8e3c2779b8cc6168ab6ffdf9c1f2ac65652404']
Modify brew prefix path in macOS system (#1719)
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -652,7 +652,7 @@ To load completions for every new session, execute once:\n \n #### macOS:\n \n-\t%[1]s completion bash > /usr/local/etc/bash_completion.d/%[1]s\n+\t%[1]s completion bash > $(brew --prefix)/et...
Go
f464d6c82e9af74b7a46301a775163984af32cd1
448
2022-06-15 20:08:16-04:00
14,400
['7dc8b004e653f2f69511378d52c2989c8f64d42b']
Add Active Help support (#1482)
[{'old_path': None, 'new_path': 'active_help.go', 'type': <ModificationType.ADD: 1>, 'diff': '@@ -0,0 +1,49 @@\n+package cobra\n+\n+import (\n+\t"fmt"\n+\t"os"\n+\t"strings"\n+)\n+\n+const (\n+\tactiveHelpMarker = "_activeHelp_ "\n+\t// The below values should not be changed: programs will be using them explicitly\n+\t...
Go
ed7bb9dda481082672ed9ea60c29b3b70ae0fc04
49
2022-06-19 22:38:49-04:00
-32,400
['f464d6c82e9af74b7a46301a775163984af32cd1']
Add unit test for fish completion (#1515)
[{'old_path': 'fish_completions_test.go', 'new_path': 'fish_completions_test.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -3,6 +3,8 @@ package cobra\n import (\n \t"bytes"\n \t"fmt"\n+\t"log"\n+\t"os"\n \t"testing"\n )\n \n@@ -80,3 +82,57 @@ func TestFishCompletionNoActiveHelp(t *testing.T) {\n \tactiveHelpVa...
Go
7c9831d376a6c048ae9f95b435cdde9dc14358a0
448
2022-06-20 00:11:21-04:00
14,400
['ed7bb9dda481082672ed9ea60c29b3b70ae0fc04']
Fix handling of descriptions for bash v3 (#1735) Fixes #1734 Tab characters that introduce completion descriptions weren't properly being handled with bash v3. This change fixes that. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -219,7 +219,7 @@ __%[1]s_handle_standard_completion_case() {\n local tab=$\'\\t\' comp\n \n # Short circuit to optimize if we don\'t have descriptions\n- if [[ ${completions[*]} != *$...
Go
ea94a3db55f84f026891709d82ebf25e17f89e0d
41
2022-06-20 20:00:50-06:00
-3,600
['7c9831d376a6c048ae9f95b435cdde9dc14358a0']
undefined or nil Args default to ArbitraryArgs (#1612)
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -1012,7 +1012,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {\n \n func (c *Command) ValidateArgs(args []string) error {\n \tif c.Args == nil {\n-\t\treturn nil\n+\t\treturn ArbitraryArgs(c, args)\n \t}...
Go
b9ca5949e2f58373e8e4c3823c213401f7d9d0e3
55
2022-06-20 20:02:33-06:00
-7,200
['ea94a3db55f84f026891709d82ebf25e17f89e0d']
use errors.Is() to check for errors (#1730) Since go 1.13 you can wrap errors. This make it no longer possible to compare with `==`, instead you have to compare with `errors.Is()`. I noticed this problem because -h was no longer working after I stared wrapping the errors in my custom FlagErrorFunc function. Note...
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -18,6 +18,7 @@ package cobra\n import (\n \t"bytes"\n \t"context"\n+\t"errors"\n \t"fmt"\n \t"io"\n \t"os"\n@@ -990,7 +991,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {\n \tif err != nil {\n \t\t// Al...
Go
5f2ec3c897155c3346e77430932e3966e5cfa648
448
2022-06-20 20:04:28-06:00
14,400
['b9ca5949e2f58373e8e4c3823c213401f7d9d0e3']
Update shell completion to respect flag groups (#1659) Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca> Co-authored-by: Marc Khouzam <marc.khouzam@montreal.ca>
[{'old_path': 'completions.go', 'new_path': 'completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -325,6 +325,9 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi\n \tvar completions []string\n \tvar directive ShellCompDirective\n \n+\t// Enforce flag groups before doing f...
Go
3d38d18a23b094d1fd08ea0c7b257704990ddecf
469
2022-06-23 09:36:12-06:00
-7,200
['06b06a9dc9f9f5eba93c552b2532a3da64ef9877']
Add KubeVirt as a project using cobra (#1741) Reaching out on behalf of KubeVirt, an add-on for Kubernetes, enabling users to run Virtual Machines on Kubernetes pods. Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -23,6 +23,7 @@\n - [Kool](https://github.com/kool-dev/kool)\n - [Kubernetes](https://kubernetes.io/)\n - [Kubescape](https://github.com/armosec/kubescape)\n+- [KubeVirt](https://github.com/k...
Go
bba9331d4e5e5ebe2d0fdf0d9432b4b1e67d5061
671
2022-06-25 19:17:06+03:00
-10,800
['3d38d18a23b094d1fd08ea0c7b257704990ddecf']
doc: Add CloudQuery for projects using Cobra (#1742)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -2,6 +2,7 @@\n \n - [Arduino CLI](https://github.com/arduino/arduino-cli)\n - [Bleve](https://blevesearch.com/)\n+- [CloudQuery](https://github.com/cloudquery/cloudquery)\n - [CockroachDB](h...
Go
69083f81b225303d63c23e14f77e4f361c4cc792
636
2022-06-28 15:19:33-06:00
-7,200
['bba9331d4e5e5ebe2d0fdf0d9432b4b1e67d5061']
Add Cilium to projects using Cobra (#1745)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -2,6 +2,7 @@\n \n - [Arduino CLI](https://github.com/arduino/arduino-cli)\n - [Bleve](https://blevesearch.com/)\n+- [Cilium](https://cilium.io/)\n - [CloudQuery](https://github.com/cloudquer...
Go
a0aadc68eb88af3acad9be0ec18c8b91438fd984
290
2022-07-07 07:54:19+03:00
-32,400
['69083f81b225303d63c23e14f77e4f361c4cc792']
Spelling for GitHub CLI (#1744)
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -3,7 +3,7 @@\n Cobra is a library for creating powerful modern CLI applications.\n \n Cobra is used in many Go projects such as [Kubernetes](https://kubernetes.io/),\n-[Hugo](https://gohugo.io), and [Github CLI](https:...
Go
965924ac89db4eb3781bfe4b376474e60c788c20
307
2022-08-04 11:18:09-04:00
-7,200
['162534f92f478e4af12e5d688615bb2c61fdb831']
docs: add zitadel to the list (#1772)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -56,3 +56,4 @@\n - [UpCloud CLI (`upctl`)](https://github.com/UpCloudLtd/upcloud-cli)\n - VMware's [Tanzu Community Edition](https://github.com/vmware-tanzu/community-edition) & [Tanzu Frame...
Go
7790bf97fd40e285913066cf65387ad281cd6c2e
678
2022-08-13 17:31:45-04:00
-7,200
['6bf8cd85825800c5cbc63009b1fb2c54185f05ed']
fix: correct command path in see_also for YAML doc (#1771) The `see_also` section for child commands would include only the name of the commands. This adds the whole path, similar to how it's done for the other documentation formats.
[{'old_path': 'doc/yaml_docs.go', 'new_path': 'doc/yaml_docs.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -128,7 +128,7 @@ func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) str\n \t\t\tif !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {\n \t\t\t\tcontinue\n \t\t...
Go
f911c0b89c6e0c41b6ad218c9235d8706c36a1b2
647
2022-08-13 17:44:47-04:00
-10,800
['7790bf97fd40e285913066cf65387ad281cd6c2e']
fix(bash-v2): activeHelp length check syntax (#1762) ```shell $ set -u $ foo=() $ echo ${#foo} bash: foo: unbound variable echo ${#foo[*]} 0 ``` The above shows that an empty array needs the suffix `[*]` when checking its length, or else it is considered unbound.
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -150,7 +150,7 @@ __%[1]s_process_completion_results() {\n __%[1]s_handle_special_char "$cur" =\n \n # Print the activeHelp statements before we finish\n- if [ ${#activeHelp} -ne 0 ]; ...
Go
dbf85f6104904d539cabceebec234e817fa0df0c
635
2022-08-13 16:18:46-06:00
-7,200
['f911c0b89c6e0c41b6ad218c9235d8706c36a1b2']
Update gopkg.in/yaml.v2 to gopkg.in/yaml.v3 (#1766) API v3 was released in 2019 [1]. Update from the v2 API, no changes to the packages's use needed and no breaking changes expected. [1] https://ubuntu.com/blog/api-v3-of-the-yaml-package-for-go-is-available
[{'old_path': 'doc/yaml_docs.go', 'new_path': 'doc/yaml_docs.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -23,7 +23,7 @@ import (\n \n \t"github.com/spf13/cobra"\n \t"github.com/spf13/pflag"\n-\t"gopkg.in/yaml.v2"\n+\t"gopkg.in/yaml.v3"\n )\n \n type cmdOption struct {\n'}, {'old_path': 'go.mod', 'new_path': ...
Go
22b617914c8890ba20db7ceafcdc2ef4ca4817d3
227
2022-08-28 12:46:39-04:00
14,400
['dbf85f6104904d539cabceebec234e817fa0df0c']
fix: show flags that shadow parent persistent flag in child help (#1776) This fixes a bug where a child flag that shadows (has the same name as) a parent persistent flag would not be shown in the child command's help output and the parent flag would be shown instead under the global flags section. This change ma...
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -1505,7 +1505,8 @@ func (c *Command) LocalFlags() *flag.FlagSet {\n \t}\n \n \taddToLocal := func(f *flag.Flag) {\n-\t\tif c.lflags.Lookup(f.Name) == nil && c.parentsPflags.Lookup(f.Name) == nil {\n+\t\t// Add the fl...
Go
704540525032e759304ffdbdacb2050dbdf4b2c5
41
2022-08-29 21:35:16-04:00
-3,600
['22b617914c8890ba20db7ceafcdc2ef4ca4817d3']
ci: test on Golang 1.19 (#1782) * ci: test on Golang 1.19 * ci: run golangci-lint on golang 1.19 * Adds `check-latest` for setup-go action v3 * ci/golangci-lint: use latest version available in setup-go's manifest Signed-off-by: John McBride <jpmmcbride@gmail.com> Signed-off-by: umarcor <unai.martinezcorr...
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -15,7 +15,8 @@ jobs:\n \n - uses: actions/setup-go@v3\n with:\n- go-version: \'1.17\'\n+ go-version: \'^1.19\'\n+ check-latest: true\n \n ...
Go
2a7647ff4661fd5bc54bdc022d349d7efe29674f
66
2022-08-29 22:12:56-04:00
-7,200
['704540525032e759304ffdbdacb2050dbdf4b2c5']
Clarify SetContext documentation (#1748)
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -236,8 +236,8 @@ func (c *Command) Context() context.Context {\n \treturn c.ctx\n }\n \n-// SetContext sets context for the command. It is set to context.Background by default and will be overwritten by\n-// Command....
Go
0580724b5fe33fbbff193befb787b1a1a0fe36a0
448
2022-08-30 08:34:58-06:00
14,400
['2a7647ff4661fd5bc54bdc022d349d7efe29674f']
With go 1.18, we must use go install for a binary (#1726) The format "go install github.com/kyoh86/richgo@latest" will work with go 1.16 and higher. It will not work with go 1.15. However, since installing "richgo" is only required for people who want to run the go tests for the Cobra project itself, I feel it is...
[{'old_path': 'Makefile', 'new_path': 'Makefile', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -6,7 +6,7 @@ $(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://insta\n endif\n \n ifeq (, $(shell which richgo))\n-$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richg...
Go
2e8ba6f3087bda425da42af31f7373cd2c2c08c5
401
2022-09-07 18:25:01-06:00
21,600
['0580724b5fe33fbbff193befb787b1a1a0fe36a0']
Use correct stale action `exempt-` yaml keys (#1800) Signed-off-by: John McBride <jpmmcbride@gmail.com>
[{'old_path': '.github/workflows/stale.yml', 'new_path': '.github/workflows/stale.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -39,8 +39,8 @@ jobs:\n days-before-close: 30\n stale-issue-label: 'lifecycle/stale'\n stale-pr-label: 'lifecycle/stale'\n- exempt-issue-label: 'lifecyc...
Go
70e53f62be77e03f376be845efacbd99c00024ca
41
2022-09-10 09:33:34-04:00
-7,200
['2e8ba6f3087bda425da42af31f7373cd2c2c08c5']
Deprecate ExactValidArgs() and test combinations of args validators (#1643) * deprecate ExactValidArgs in favour of MatchAll(OnlyValidArgs, ...) * test combinations of args validators * adjust docs
[{'old_path': 'args.go', 'new_path': 'args.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -32,7 +32,8 @@ func NoArgs(cmd *Command, args []string) error {\n \treturn nil\n }\n \n-// OnlyValidArgs returns an error if any args are not in the list of ValidArgs.\n+// OnlyValidArgs returns an error if there are any p...
Go
d689184a421607457a18131e0a2b602fec22e3b4
675
2022-09-11 08:25:22-04:00
-10,800
['70e53f62be77e03f376be845efacbd99c00024ca']
Support for case-insensitive command names (#1802) Add a global `EnableCaseInsensitive` variable to allow case-insensitive command names. The variable supports commands names and aliases globally. Resolves #1382
[{'old_path': 'cobra.go', 'new_path': 'cobra.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -40,14 +40,23 @@ var templateFuncs = template.FuncMap{\n \n var initializers []func()\n \n+const (\n+\tdefaultPrefixMatching = false\n+\tdefaultCommandSorting = true\n+\tdefaultCaseInsensitive = false\n+)\n+\n // Enabl...
Go
fe08012eddbdf42edd466b8defeee33ec0ec4446
448
2022-09-11 15:04:53-06:00
14,400
['d689184a421607457a18131e0a2b602fec22e3b4']
Rename Powershell completion tests (#1803) The name of the powershell completion test file did not match the actual powershell file. Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
[{'old_path': 'power_completions_test.go', 'new_path': 'powershell_completions_test.go', 'type': <ModificationType.RENAME: 3>, 'diff': ''}]
Go
7e289f46f1d1b2567b123cc26db0e7cd76644c32
448
2022-09-11 17:48:42-04:00
14,400
['fe08012eddbdf42edd466b8defeee33ec0ec4446']
Adjustments to documentation (#1656) Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -40,9 +40,9 @@ The best applications read like sentences when used, and as a result, users\n intuitively know how to interact with them.\n \n The pattern to follow is\n-`APPNAME VERB NOUN --ADJECTIVE.`\n+`APPNAME VERB ...
Go
4065a33bfdf697b6ce748a521686aee7edc748eb
41
2022-09-13 21:31:59-06:00
-7,200
['7e289f46f1d1b2567b123cc26db0e7cd76644c32']
ci: use action/setup-go's cache (#1783) * ci: use action/setup-go's cache * ci: deprecate Golang 1.14
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -13,10 +13,13 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n \n+ - uses: actions/checkout@v3\n+\n - uses: actions/setup-go@v3\n with:\n go-version: '...
Go
6d978a911e7fff69b1ca2a873dd91d78ebca44cf
41
2022-09-16 07:55:56-04:00
-7,200
['4065a33bfdf697b6ce748a521686aee7edc748eb']
add missing license headers (#1809)
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -9,6 +9,25 @@ env:\n \n jobs:\n \n+\n+ lic-headers:\n+ runs-on: ubuntu-latest\n+ steps:\n+\n+ - uses: actions/checkout@v3\n+\n+ - run: >-\n+ docker run\n+ ...
Go
459fc5fce316465d5abc60faae27aa99687d62dc
41
2022-09-16 16:23:19-04:00
-7,200
['6d978a911e7fff69b1ca2a873dd91d78ebca44cf']
ci: add workflow_dispatch (#1387)
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -3,6 +3,7 @@ name: Test\n on:\n push:\n pull_request:\n+ workflow_dispatch:\n \n env:\n GO111MODULE: on\n'}]
Go
a281c8b47b315fe428cf31ad5c38b526dc136f55
448
2022-09-16 14:44:28-06:00
14,400
['459fc5fce316465d5abc60faae27aa99687d62dc']
Document option to hide the default completion cmd (#1779) Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com> Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
[{'old_path': 'shell_completions.md', 'new_path': 'shell_completions.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -99,6 +99,11 @@ To tell Cobra *not* to provide the default `completion` command:\n rootCmd.CompletionOptions.DisableDefaultCmd = true\n ```\n \n+To tell Cobra to mark the default `completion` comm...
Go
fce8d8aeb08dc6afe413cc0af67a7fbb3cffec4c
360
2022-09-27 06:27:48-04:00
-28,800
['a281c8b47b315fe428cf31ad5c38b526dc136f55']
Expose ValidateRequiredFlags and ValidateFlagGroups (#1760)
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -862,10 +862,10 @@ func (c *Command) execute(a []string) (err error) {\n \t\tc.PreRun(c, argWoFlags)\n \t}\n \n-\tif err := c.validateRequiredFlags(); err != nil {\n+\tif err := c.ValidateRequiredFlags(); err != nil ...
Go
7039e1fa214cfc1de404ed6540158c8fda64a758
308
2022-09-30 14:26:05-04:00
25,200
['fce8d8aeb08dc6afe413cc0af67a7fbb3cffec4c']
Add '--version' flag to Help output (#1707)
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -1124,6 +1124,7 @@ Simply type ` + c.Name() + ` help [path to command] for full details.`,\n \t\t\t\t\tCheckErr(c.Root().Usage())\n \t\t\t\t} else {\n \t\t\t\t\tcmd.InitDefaultHelpFlag() // make possible 'help' fl...
Go
3dc9761b36e8975006cd9b47d3b55b9751050a1e
277
2022-10-03 08:52:01-06:00
-10,800
['7039e1fa214cfc1de404ed6540158c8fda64a758']
Add allero to list of projects using cobra (#1819)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -1,5 +1,6 @@\n ## Projects using Cobra\n \n+- [Allero](https://github.com/allero-io/allero)\n - [Arduino CLI](https://github.com/arduino/arduino-cli)\n - [Bleve](https://blevesearch.com/)\n ...
Go
93d1913fb03362f97e95aeacc7d1541764cafc2f
668
2022-10-03 08:52:50-06:00
-7,200
['07034fee4995578a771c4185dab38cc16ac3f420']
Add OnFinalize method (#1788) This method is the OnInitialize counterpart. Like OnInitialize which allows loading the configuration before each command is executed, OnFinalize allows saving the configuration after each command has been executed.
[{'old_path': 'cobra.go', 'new_path': 'cobra.go', 'type': <ModificationType.MODIFY: 5>, 'diff': "@@ -40,6 +40,7 @@ var templateFuncs = template.FuncMap{\n }\n \n var initializers []func()\n+var finalizers []func()\n \n const (\n \tdefaultPrefixMatching = false\n@@ -94,6 +95,12 @@ func OnInitialize(y ...func()) {\n \ti...
Go
23fc5e099f7bb8b8f979e3928cb1078b9c939daa
644
2022-10-03 08:53:12-06:00
25,200
['93d1913fb03362f97e95aeacc7d1541764cafc2f']
ci: add minimum GitHub token permissions for workflows (#1792) Signed-off-by: Varun Sharma <varunsh@stepsecurity.io>
[{'old_path': '.github/workflows/labeler.yml', 'new_path': '.github/workflows/labeler.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -2,8 +2,14 @@ name: "Pull Request Labeler"\n on:\n - pull_request_target\n \n+permissions:\n+ contents: read\n+\n jobs:\n triage:\n+ permissions:\n+ contents: read # ...
Go
d4040ad8dbc351b7eb88b2ffcff6f3642bce8ce1
448
2022-10-03 13:06:04-04:00
14,400
['23fc5e099f7bb8b8f979e3928cb1078b9c939daa']
Allow user to add completion for powershell alias (#1621) When a user has an alias in powershell, she will need to register that alias for completion. To make that possible, we store the completion logic into a scriptblock variable which can easily be accessed by the user to register aliases. For example, if th...
[{'old_path': 'powershell_completions.go', 'new_path': 'powershell_completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -22,9 +22,15 @@ import (\n \t"fmt"\n \t"io"\n \t"os"\n+\t"strings"\n )\n \n func genPowerShellComp(buf io.StringWriter, name string, includeDesc bool) {\n+\t// Variables should not conta...
Go
212ea4078323771dc49b6f25a41d84efbaac3a4c
448
2022-10-04 16:41:30-06:00
14,400
['d4040ad8dbc351b7eb88b2ffcff6f3642bce8ce1']
Include --help and --version flag in completion (#1813) Fixes #1786 The --help, -h, --version and -v flags are normally added when the `execute()` function is called on a command. When doing completion we don't call `execute()` so we need to add these flags explicitly to the command being completed. Also, we...
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -30,6 +30,8 @@ import (\n \tflag "github.com/spf13/pflag"\n )\n \n+const FlagSetByCobraAnnotation = "cobra_annotation_flag_set_by_cobra"\n+\n // FParseErrWhitelist configures Flag parse errors to be ignored\n type FP...
Go
2169adb5749372c64cdd303864ae8a444da6350f
39
2022-10-10 14:59:11-06:00
-7,200
['212ea4078323771dc49b6f25a41d84efbaac3a4c']
Add groups for commands in help (#1003) * Add tests for grouping commands * Adds Additional Command section in help Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com> Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -23,6 +23,7 @@ Cobra provides:\n * Global, local and cascading flags\n * Intelligent suggestions (`app srver`... did you mean `app server`?)\n * Automatic help generation for commands and flags\n+* Grouping help for su...
Go
860791844ed3a2e544a9b9bbbcb14144a948ad20
338
2022-10-10 19:06:30-04:00
-3,600
['2169adb5749372c64cdd303864ae8a444da6350f']
feat: make InitDefaultCompletionCmd public (#1467) * feat: make InitDefaultCompletionCmd public * PR comments * Update man_docs_test.go * Update README.md
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -996,7 +996,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {\n \t// initialize help at the last point to allow for user overriding\n \tc.InitDefaultHelpCmd()\n \t// initialize completion at the last poin...
Go
1424b7b92743e634e20f611e99a495e411fa4732
266
2022-10-13 09:47:58-04:00
-7,200
['860791844ed3a2e544a9b9bbbcb14144a948ad20']
Add Constellation to projects using cobra. (#1829)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -6,6 +6,7 @@\n - [Cilium](https://cilium.io/)\n - [CloudQuery](https://github.com/cloudquery/cloudquery)\n - [CockroachDB](https://www.cockroachlabs.com/)\n+- [Constellation](https://github....
Go
badcce14f8e828cda4d8ac404a12448700de1441
647
2022-10-17 15:24:27-04:00
-10,800
['1424b7b92743e634e20f611e99a495e411fa4732']
style(bash-v2): various cleanups (#1702) * use arithmetic evaluation in numeric context * remove unnecessary $ from array index variables * [[ ]] over [ ], == over =, remove unnecessary quoting * use ${foo-} rather than ${foo:-} in emptiness check The result of the expansion is null no matter if the variab...
[{'old_path': 'bash_completionsV2.go', 'new_path': 'bash_completionsV2.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -38,7 +38,7 @@ func genBashComp(buf io.StringWriter, name string, includeDesc bool) {\n \n __%[1]s_debug()\n {\n- if [[ -n ${BASH_COMP_DEBUG_FILE:-} ]]; then\n+ if [[ -n ${BASH_COMP_DEBUG_...
Go
4b9d00dfecd605048ddf3ad2a81afcab381ac1ae
284
2022-10-20 16:33:37-04:00
-7,200
['badcce14f8e828cda4d8ac404a12448700de1441']
Replace deprecated ExactValidArgs with MatchAll in user_guide and shell_completions example (#1836)
[{'old_path': 'shell_completions.md', 'new_path': 'shell_completions.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -71,7 +71,7 @@ PowerShell:\n `,cmd.Root().Name()),\n \tDisableFlagsInUseLine: true,\n \tValidArgs: []string{"bash", "zsh", "fish", "powershell"},\n-\tArgs: cobra.Exact...
Go
10cf7be9972ee5b5994cf760ecba642309ac8685
448
2022-10-24 11:11:57-04:00
14,400
['4b9d00dfecd605048ddf3ad2a81afcab381ac1ae']
Check for group presence after full initialization (#1839) Fixes #1831 By moving the check for help group existence to "ExecuteC()" we no longer need groups to be added before AddCommand() is called. This provides more flexibility to developers and works better with the use of "init()" for command creation. ...
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -998,6 +998,10 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {\n \t// initialize completion at the last point to allow for user overriding\n \tc.InitDefaultCompletionCmd()\n \n+\t// Now that all commands ...
Go
cc7e235fc26cfd0b5ae36c960f399eea4badaa3e
105
2022-11-01 09:15:28-04:00
-3,600
['10cf7be9972ee5b5994cf760ecba642309ac8685']
Add Sia to projects using Cobra (#1844)
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -52,6 +52,7 @@\n - [Random](https://github.com/erdaltsksn/random)\n - [Rclone](https://rclone.org/)\n - [Scaleway CLI](https://github.com/scaleway/scaleway-cli)\n+- [Sia](https://github.com/...
Go
6b0bd3076cfafd1c108264ed1e4aa0c0fe3f8537
227
2022-11-07 23:12:02-05:00
18,000
['cc7e235fc26cfd0b5ae36c960f399eea4badaa3e']
fix: don't remove flag value that matches subcommand name (#1781) When the command searches args to find the arg matching a particular subcommand name, it needs to ignore flag values, as it is possible that the value for a flag might match the name of the sub command. This change improves argsMinusFirstX() to ig...
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -655,15 +655,39 @@ Loop:\n \n // argsMinusFirstX removes only the first x from args. Otherwise, commands that look like\n // openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]).\n...
Go
ad6db7f8f6e485f55b1561df9276fa4d8e278bde
227
2022-11-14 21:46:57-05:00
18,000
['6b0bd3076cfafd1c108264ed1e4aa0c0fe3f8537']
Create unit test illustrating unknown flag bug (#1854) Created a unit test that tests the unknown flag error message when the unknown flag is located in different arg positions.
[{'old_path': 'command_test.go', 'new_path': 'command_test.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -2692,3 +2692,46 @@ func TestFind(t *testing.T) {\n \t\t})\n \t}\n }\n+\n+func TestUnknownFlagShouldReturnSameErrorRegardlessOfArgPosition(t *testing.T) {\n+\ttestCases := [][]string{\n+\t\t//{"--unknown", ...
Go
430549841b79b3731b27df81e2752b729fd4ae43
293
2022-11-21 21:04:26-05:00
-3,600
['ad6db7f8f6e485f55b1561df9276fa4d8e278bde']
Update stale.yml (#1863)
[{'old_path': '.github/workflows/stale.yml', 'new_path': '.github/workflows/stale.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -28,7 +28,7 @@ jobs:\n You can:\n \n - Make a comment to remove the stale label and show your support. The 60 days reset.\n- - If an issue has lifecycle/...
Go
c6b99719235fcb18d950f972f27d95fdb0347f02
518
2022-11-25 15:47:20-05:00
-3,600
['430549841b79b3731b27df81e2752b729fd4ae43']
fix: force ForEach-Object to return array in pwsh completion (#1850) Fixes #1847
[{'old_path': 'powershell_completions.go', 'new_path': 'powershell_completions.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -137,7 +137,7 @@ filter __%[1]s_escapeStringWithSpecialChars {\n }\n \n $Longest = 0\n- $Values = $Out | ForEach-Object {\n+ [Array]$Values = $Out | ForEach-Object {\n ...
Go
6200c8e551774046849aafbbc28a74f485e15749
41
2022-11-25 15:55:09-05:00
0
['c6b99719235fcb18d950f972f27d95fdb0347f02']
Makefile: add target richtest (#1865) Don't require contributors to install richgo but keep it as an option and for CI
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -88,7 +88,7 @@ jobs:\n go install github.com/kyoh86/richgo"${_version}"\n go install github.com/mitchellh/gox"${_version}"\n \n- - run: RICHGO_FORCE_COLOR=1 PATH=$HO...
Go
a6f198b635c4b18fff81930c40d464904e55b161
287
2022-12-06 08:20:58-05:00
-7,200
['7bb14400030441629c9c78b2317dfe9f2254e022']
Update kubescape org (#1874) Signed-off-by: David Wertenteil <dwertent@armosec.io>
[{'old_path': 'projects_using_cobra.md', 'new_path': 'projects_using_cobra.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -26,7 +26,7 @@\n - [Istio](https://istio.io)\n - [Kool](https://github.com/kool-dev/kool)\n - [Kubernetes](https://kubernetes.io/)\n-- [Kubescape](https://github.com/armosec/kubescape)\n+- [...
Go
923592041e4ae38e2ae5c3cc66c3eb1e0c27261f
41
2022-12-09 16:57:19-05:00
0
['a6f198b635c4b18fff81930c40d464904e55b161']
ci: deprecate go 1.15 (#1866) Remove testing for go 1.15 to allow CI to pass, but don't force projects to upgrade.
[{'old_path': '.github/workflows/test.yml', 'new_path': '.github/workflows/test.yml', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -63,7 +63,6 @@ jobs:\n - ubuntu\n - macOS\n go:\n- - 15\n - 16\n - 17\n - 18\n@@ -81,12 +80,8 @@ jobs:\n \n - run: |\n ...
Go
f25a3c6e0b4220c616a3b342b57b055c1256d318
15
2022-12-15 05:39:50-05:00
-19,800
['923592041e4ae38e2ae5c3cc66c3eb1e0c27261f']
fix: conflict import name with variable (#1879) `template` is an import in `cobra.go` file and also used as a variable name, which masks the library in the scope of that function.
[{'old_path': 'cobra.go', 'new_path': 'cobra.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -167,8 +167,8 @@ func appendIfNotPresent(s, stringToAppend string) string {\n \n // rpad adds padding to the right of a string.\n func rpad(s string, padding int) string {\n-\ttemplate := fmt.Sprintf("%%-%ds", padding)\n...
Go
fdffa5a4c760e30a38e596299b91c328ffd461bc
587
2022-12-23 15:54:16-05:00
-32,400
['f25a3c6e0b4220c616a3b342b57b055c1256d318']
Update badge route (#1884) Based on https://github.com/badges/shields/issues/8671
[{'old_path': 'README.md', 'new_path': 'README.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -6,7 +6,7 @@ Cobra is used in many Go projects such as [Kubernetes](https://kubernetes.io/),\n [Hugo](https://gohugo.io), and [GitHub CLI](https://github.com/cli/cli) to\n name a few. [This list](./projects_using_cobra...
Go
bf11ab6321f2831be5390fdd71ab0bb2edbd9ed5
15
2022-12-25 15:08:39-05:00
-19,800
['fdffa5a4c760e30a38e596299b91c328ffd461bc']
fix: func name in doc strings (#1885) Corrected the function name at the start of doc strings, as per the convention outlined in official go documentation: https://go.dev/blog/godoc
[{'old_path': 'args.go', 'new_path': 'args.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -21,7 +21,7 @@ import (\n \n type PositionalArgs func(cmd *Command, args []string) error\n \n-// Legacy arg validation has the following behaviour:\n+// legacyArgs validation has the following behaviour:\n // - root comman...
Go
b4f979ae352828a0153281b590771ce9588d67f8
283
2023-01-02 19:58:36-05:00
-3,600
['bf11ab6321f2831be5390fdd71ab0bb2edbd9ed5']
completions: do not detect arguments with dash as 2nd char as flag (#1817) Fixes #1816 Previously, arguments with a dash as the second character (e.g., 1-ff00:0:1) were detected as a flag by mistake. This resulted in auto completion misbehaving if such an argument was last in the argument list during invocation.
[{'old_path': 'command.go', 'new_path': 'command.go', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -692,7 +692,7 @@ Loop:\n }\n \n func isFlagArg(arg string) bool {\n-\treturn ((len(arg) >= 3 && arg[1] == \'-\') ||\n+\treturn ((len(arg) >= 3 && arg[0:2] == "--") ||\n \t\t(len(arg) >= 2 && arg[0] == \'-\' && arg[1]...
Go
d022c0fe2b70e61f7edc264ef5639cdf71e9ceb3
152
2023-01-30 12:58:20-05:00
-28,800
['4fa4fdf5cd34cb78973561d077461caea8eeb48a']
Add documentation about disabling completion descriptions (#1901)
[{'old_path': 'shell_completions.md', 'new_path': 'shell_completions.md', 'type': <ModificationType.MODIFY: 5>, 'diff': '@@ -385,6 +385,19 @@ or\n ```go\n ValidArgs: []string{"bash\\tCompletions for bash", "zsh\\tCompletions for zsh"}\n ```\n+\n+If you don\'t want to show descriptions in the completions, you can add `-...
Go