Commit Graph

1046 Commits

Author SHA1 Message Date
Paul Holzinger a4ab3fa09e
powershell completion with custom comp (#1208)
The current powershell completion is not very capable.

Let's port it to the go custom completion logic to have a
unified experience accross all shells.

Powershell supports three different completion modes

- TabCompleteNext (default windows style - on each key press the next option is displayed)
- Complete (works like bash)
- MenuComplete (works like zsh)

You set the mode with `Set-PSReadLineKeyHandler -Key Tab -Function <mode>`

To keep it backwards compatible `GenPowerShellCompletion` will not display descriptions.
Use `GenPowerShellCompletionWithDesc` instead. Descriptions will only be displayed with
`MenuComplete` or `Complete`.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-29 07:57:32 -07:00
Jon Love 471c9ac367
Add the new Twitch CLI to to projects_using_cobra.md (#1301) 2020-12-29 07:39:22 -07:00
namusyaka 7df62f7668
fix typos (#1274) 2020-12-04 12:34:11 -07:00
zaataylor 39b5a91b20
README.md Readability Improvements (#1228)
I made some small changes to the README.md file to enhance its readability.
2020-12-04 12:15:09 -07:00
Vincent 08c51e585c
Add ORY Hydra & Kratos to projects_using_cobra.md (#1273)
* Add ORY Hydra & Kratos to projects_using_cobra.md

* fix: alphabetical order

my bad!

* fix: ORY to Ory

I think now it should be good, 
sorry for the confusion!
2020-11-09 16:46:15 -07:00
Sascha Steinbiss 86f8bfd7fe
fix manpage building with new go-md2man (#1255)
This addresses #1049 by changing the format of the generated
Markdown input.
2020-10-18 12:59:26 -06:00
Marc Khouzam f32f4ef15b
Don't use yaml.v2 2.3.0 which has a breaking change (#1259)
yaml.v2 contains a breaking change from
https://github.com/go-yaml/yaml/pull/571

yaml.v2 2.2.8 does not have that change and also addresses the CVE that
was behind the move to yaml.v2 2.3.0.  This commit reverts to using
yaml.v2 2.2.8

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-10-18 12:50:48 -06:00
Adam Demuri 142dfb15a8
Add example for making persistent flags required (#1135) 2020-10-14 09:53:09 -06:00
Alessio Treglia 723d0c36fc
Add tendermint and cosmos-sdk to the list of projects using cobra (#855)
* Add tendermint and cosmos-sdk to the list of projects using cobra

Co-authored-by: Steve Francia <steve.francia@gmail.com>
2020-10-14 09:51:35 -06:00
Matej Vasek b97b5ead31
fix: fish output redirection (#1247)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2020-10-05 21:54:06 -06:00
midchildan f64bfa1e08
Fix zsh completion not working on the first time in a shell session (#1237)
The zsh completion script output by cobra is a stub completion function
which replaces itself with the actual completion function. This
technique enables cobra to define helper functions without splitting the
completion script into multiple files.  However, the current
implementation forgets to call the actual completion function at the end
of the stub function, meaning that completion won't work the first time
it's invoked in a shell session. This commit is a fix for this problem.
2020-10-03 19:25:07 -06:00
Alessio Treglia 40d34bca1b
Fix stderr printing functions (#894)
* Fix stderr printing functions

Follow-up of #822

* Errors go to stderr as per POSIX

* use PrintErrf() instead of extra call to Sprintf()

* Error messages should always be printed to os.Stderr.

* add test case for Print* redirection

Thanks: @bukowa for the patch.
2020-10-01 09:28:00 -06:00
John McBride 0bc8bfbe59
Remove secondary go mod to prevent broken `go get` (#1233) 2020-09-23 16:26:21 -06:00
Danny Hermes 7f8e83d936
Modifying "snake-case" to "kebab-case" for clarity. (#1196) 2020-09-16 09:27:58 -06:00
Arda Aytekin 8a39cb2614
Bug fix in README (#1199)
Bug fixed in `README.md`.
2020-09-16 09:26:27 -06:00
Fabrício José Souza 2a8d0f327d
Adding Kool to list of projects using cobra (#1224) 2020-09-15 08:45:35 -06:00
Umberto Baldi 6c06523c96
add arduino-cli to projects using cobra (#1117)
* add arduino-cli to projects using cobra
2020-09-15 08:44:32 -06:00
Luap99 8a63648dd9
Handle linebreaks in custom completions. (#1162)
If a command/flag description contains
a linebreak then the shell completion script
will interpret this as new command/flag.

To fix this we only use the first line
from the description in the output.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-09 11:27:42 -06:00
Luap99 50258f15eb
Complete subcommands when TraverseChildren is set (#1171)
* Complete subcommands when TraverseChildren is true in custom completion

The current custom completion logic does not complete
subcommands when a local flag is set. This is good unless
TraverseChildren is set to true where local flags
can be set on parent commands.

This commit allows subcommands to be completed
if TraverseChildren is set to true on the root cmd.

Closes #1170

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>

* Complete subcommands when TraverseChildren is true in bash completion

The current bash completion logic does not complete
subcommands when a local flag is set. There is also a bug
where subcommands are sometimes still getting completed. see: #1172

If TraverseChildren is true we should allow subcommands
to be completed even if a local flag is set.

Closes #1172

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-09 09:34:51 -06:00
Marc Lopez Rubio 02a0d2fbc9
doc: GenMarkdown skip Synopsis on empty long cmd (#1207)
This patch modifies the GenMarkdownCustom to skip writing a Synopsis
header with the `cmd.Short` duplicated both before and after the header.

Instead, it only writes the `### Synopsis` header and the paragraph when
a `cmd.Long` has some kind of content in it.

Adds `TestGenMdDocWithNoLongOrSynopsis` as the test case.

Signed-off-by: Marc Lopez <marc5.12@outlook.com>
2020-08-26 09:18:51 -06:00
Joshua Harshman 9ed1d713d6
bugfix/cli: Temporary fix for go get on cobra cli (#1200)
PR #1139 introduced a complexity that will have to be taken into account
as we figure out our release pipeline. This fix pins to cobrav1.0.0 as a
temporary workaround.

fixes: #1191
2020-08-23 13:45:41 -04:00
Michael Muré 8cfa4b4acf
Add documentation for Use (#1188) 2020-08-18 14:14:09 -06:00
Michael Muré 81e0311edd
modules: add a secondary go.mod to segregate CLI dependencies (#1139) 2020-08-15 10:44:17 -04:00
Michael Samoylov 5cdf8e26ba
Fix typo (#1187) 2020-08-11 08:39:51 -04:00
Felix Yan a0b86e58f8
Correct a typo in doc/util.go (#1184) 2020-08-10 22:17:29 -06:00
Warren Fernandes a738b60e52
Add CONTRIBUTING.md (#1183) 2020-08-10 22:14:21 -06:00
Erdal TAŞKESEN 96dc55577f
Update projects_using_cobra.md (#1147)
Adds git-bump, gh-labels, and random to list of projects
2020-08-05 09:36:41 -06:00
Warren Fernandes 0e27f22f6e
Add slack badge to point to cobra slack channel (#1181) 2020-07-31 09:53:44 -06:00
Marc Khouzam c6fe2d4df8
Improve zsh completion documentation (#1169)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-07-19 16:02:46 -06:00
Dmitry Shurupov 19e41cf081
Adding werf to projects using cobra (#1163)
werf is a CI/CD & GitOps tool. Cobra is used in [werf's CLI](https://github.com/werf/werf/blob/master/cmd/werf/main.go).
2020-07-17 15:48:45 -06:00
Tam Mach b95db644ed
Add golangci-lint in project using cobra (#1150) 2020-07-14 21:12:39 -06:00
umarcor 884edc58ad
update viper and pflag (#1012) 2020-07-13 11:55:00 -06:00
Marc Khouzam 675ae5f5a9
Fish does not accept - or : in vars (#1122)
Fixes #1121.
This is for programs that may contain a : or - in their name.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-07-10 14:12:46 -06:00
Diana Flach 5d5290759a
Update README.md (#1154)
I found this through a comment on an issue and thought this might save someone some time looking through the code.

fixes #1148
2020-07-10 14:06:59 -06:00
Sean Prince 207dc47664
Close #1152 by upgrading yaml.v2 to v2.3.0 (#1153) 2020-07-10 08:32:03 -04:00
Marc Khouzam 2c5a0d300f
Extend Go completions and revamp zsh comp (#1070) (#1070)
Replace the current Zsh completion with a Zsh completion solution based
on Go completions. This allows to support custom completions (based
on Go completions), but also to standardize the behavior of completion
across all shells.

Also, add support to Go completions for the bash completion annotations:
  BashCompFilenameExt (including Command.MarkFlagFilename() family)
                       - still supported by zsh
  BashCompSubdirsInDir - now supported by zsh
  BashCompOneRequiredFlag (including Command.MarkFlagRequired() family)
                       - now supported by zsh and fish

Finally, remove the suggestin of the = form of flag completion.
The = form is supported, but it will not be suggested to avoid having
duplicated suggestions.
2020-06-29 13:52:14 -06:00
Marc Khouzam 04318720db
Add completion for help command (#1136)
* Don't exclude 'help' from bash completions

Fixes #1000.

* Provide completion for the help command

1- Show 'help' as a possible completion
2- Provide completions for the help command itself

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Co-authored-by: Zaven Muradyan <voithos@google.com>
2020-06-16 14:49:26 -06:00
Alessandro (Ale) Segala ed7b60e298
YAML documentation contains "Usage" (#1037) 2020-06-15 16:51:03 -06:00
Vaibhav Kaushik 1d3ac910d4
Update projects_using_cobra.md (#1113)
* Removing deprecated projects
* Update etcd website
2020-05-29 10:17:41 -06:00
Joshua Harshman 94a87a7b83
disable periodic labeler (#1112) 2020-05-08 09:53:33 -06:00
Marc Khouzam 5155946348
Ignore required flags when DisableFlagParsing (#1095)
When a command request to DisableFlagParsing, it should not fail due
to a missing required flag.  In fact, such a check will always fail
since flags weren't parsed!

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-05-07 19:18:16 -06:00
Stefan Majer aa5badda62
Metal Stack CLI is using cobra as well (#1094) 2020-05-07 19:13:20 -06:00
John Calabrese a7aaa7cfac
replace labeler action with periodic-labeler (#1097)
* replace labeler action with periodic-labeler

this replaces the default labeler as it
does not label PRs from forks properly.

with periodic-labeler it should apply labels on
a cron to any PR and resolve the below bug:

https://github.com/spf13/cobra/issues/1092
2020-05-07 19:02:17 -06:00
Marc Khouzam f8fdd17383
Complete command names even if ValidArgs present (#1088)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-05-07 15:04:14 -06:00
John McBride e392f3204d
Man pages won't have auto gen tag when option is disabled (#1104)
* Man pages wont have  auto gen tag when option is disabled

- this addresses #741

* Add documentation for doc generation and a changelog
2020-04-29 11:15:55 -06:00
Warren Fernandes 41fd44e1df
Fix cobra init cmd help documentation (#1108)
Adds tests for other cases where we do not expect projects to be created
for absolute paths and relative paths in GOPATH.
2020-04-28 16:59:18 -06:00
Warren Fernandes 44d55fb4d3
Fix cobra command README (#1106)
Describes the behavior of custom LICENSE generation using properties in
~/.cobra.yml
2020-04-28 11:49:46 -06:00
Marc Khouzam 11ba63fc3b
Add Helm as project using Cobra (#1103)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-04-25 09:03:04 -06:00
Warren Fernandes 090d94f474
Move projects using Cobra (#1090)
Since there are so many projects using Cobra, we created a separate
document to list them
2020-04-16 11:00:24 -06:00
Amit Botzer 8c638d3f90
Fixed typo. (#1087)
Changed 'applicaton' to 'application'.
2020-04-10 15:30:10 -06:00