Commit graph

16 commits

Author SHA1 Message Date
Marc Khouzam
83e08a7a16
Merge b1acb500a2 into 0fc86c2ffd 2024-04-08 11:14:43 +00:00
Xinwei Xiong
0fc86c2ffd
docs: update user guide (#2128) 2024-04-08 06:47:35 -04:00
montag451
bd2655e76c
Add Incus to the list of projects using Cobra (#2118) 2024-03-07 19:36:58 -05:00
Radek Smid
bcfcff729e
Add Taikun CloudWorks to list of projects (#2098) 2024-01-15 08:38:50 -05:00
Case Wylie
cbcf75eab9
[chore]: update projects using cobra (#2093)
Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
2023-12-27 21:16:29 -05:00
Nir Soffer
41227856cd Document how to create a plugin
Using the new CommandDisplayNameAnnotation annotation introduced in
Cobra 1.8.0.
2023-12-17 19:58:57 -05:00
Ville Skyttä
e63925d321
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.
2023-12-17 13:50:59 -05:00
Marcus Kohlberg
236f3c0418
Update projects_using_cobra.md (#2089)
Add Encore to the list of projects using Cobra
2023-12-12 11:26:29 -05:00
SwagPack
283e32d889
Add LXC to the list of projects using cobra (#2071) 2023-11-13 11:55:06 -05:00
Ville Skyttä
22953d8845
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
2023-10-29 12:06:51 -06:00
vkhoroz
4cafa37bc4
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:
- https://github.com/spf13/cobra/issues/216
- https://github.com/spf13/cobra/issues/252

Signed-off-by: Volodymyr Khoroz <volodymyr.khoroz@foundries.io>
2023-10-21 20:36:12 -04:00
Haoming Meng
95d8a1e45d
Add notes to doc on preRun and postRun condition (#2041) 2023-10-09 08:50:40 -04:00
Souma
0c72800b8d
Customizable error message prefix (#2023) 2023-09-08 13:29:06 -04:00
Martijn Evers
c81c46a015
Add 'one required flag' group (#1952) 2023-07-16 12:38:22 -04:00
Marc Khouzam
b1acb500a2 Remove the default "completion" cmd if it is alone
When a program has no sub-commands, its root command can accept
arguments.  If we add the default "completion" command to such programs
they will now have a sub-command and will no longer accept arguments.

What we do instead for this special case, is only add the "completion"
command if it is being called, or if it is being completed itself.

We want to have the "completion" command for such programs because it
will allow the completion of flags and of arguments (if provided
by the program).

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
2023-06-21 07:08:45 -04:00
Unai Martinez-Corral
dcb405a939
Move documentation sources to site/content (#1428) 2023-06-20 17:15:36 -04:00