Commit Graph

16 Commits

Author SHA1 Message Date
Nir Soffer ff7c561cf7
Improve site formatting (#2183)
* Improve site formatting

- Separate titles with blank lines
- Separate code blocks with blank lines
- Always use ``` blocks for examples
- Use console for console (bash syntax highlighting does work well with
  example command output)
- Start console examples with $ (highlight command and output
  differently and more friendly to other shells users)

* Unify indentation in example project structure

* Use single import line in the trivial examples

When we want to show a minimal example with single import it looks
cleaner and more minimal with a single line.
2024-10-12 11:35:01 -04:00
Nir Soffer 511af59cb3
Replace deprecated ioutil usage (#2181)
Fixing golangci-lint errors[1]:

    Error: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of
    Go 1.16, the same functionality is now provided by package [io] or
    package [os], and those implementations should be preferred in new
    code. See the specific function documentation for details.
    (staticcheck)

[1] https://github.com/spf13/cobra/actions/runs/10535452454/job/29194442289?pr=2180
2024-08-24 07:05:26 -04: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
Unai Martinez-Corral dcb405a939
Move documentation sources to site/content (#1428) 2023-06-20 17:15:36 -04:00