Commit Graph

1089 Commits

Author SHA1 Message Date
Jack Wright da1bab9757 Fixed the ShellCompDirectiveNoFileComp case 2024-12-11 17:22:41 -08:00
Jack Wright 1df1dbd552 cobra logging command 2024-12-08 20:34:38 -08:00
Jack Wright 52185bed6e tweaking extra completion instructions 2024-12-08 19:44:45 -08:00
Jack Wright d728bbb91e Nushell instructions tweak 2024-12-08 19:40:45 -08:00
Jack Wright 14e642ede9 fixed bad grammar mistake 2024-12-08 19:35:50 -08:00
Jack Wright e0ac28fad8 fix fish reference 2024-12-08 19:33:48 -08:00
Jack Wright 93a41331ec tmpfile handling changes 2024-12-01 20:05:39 -08:00
Jack Wright 470ca0a628 Added a comment at the beginning to remain consistent with other shells. 2024-12-01 20:05:18 -08:00
Jack Wright ddb39920b4 More documentation work for nushell 2024-12-01 18:44:56 -08:00
Jack Wright 1886f6baad minor formatting tweak 2024-12-01 18:27:49 -08:00
Jack Wright 2f80e0879f changed from being markdown, as I don't think the docs here are markdown 2024-11-30 15:01:06 -08:00
Jack Wright 18d7a29987 more documentation tweaks 2024-11-30 14:58:44 -08:00
Jack Wright 59726e2b0f fixed a typo 2024-11-30 14:06:56 -08:00
Jack Wright 982ba402cb fix tests 2024-11-30 13:59:41 -08:00
Jack Wright 7006719603 fixing formatting 2024-11-30 13:57:31 -08:00
Jack Wright 8b4aa590bb Added new directive to the list of directives for posterity. 2024-11-30 13:34:39 -08:00
Jack Wright 7eac0e11ae Format with spaces instead of tabs 2024-11-30 13:32:05 -08:00
Jack Wright e7abbf39a3 rewriting nushell implementation 2024-11-29 12:30:16 -08:00
Jack Wright 29af015b57 "fixed whitespace" 2024-11-29 12:30:16 -08:00
Jack Wright f963733c4e "Reverted to old version without formatting changes and readded nushell" 2024-11-29 12:30:16 -08:00
Jack Wright 1a69a83abc "Added nushell to list of shell autompletes" 2024-11-29 12:30:16 -08:00
Jack Wright 8cb9728476 Update completions.go
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
2024-11-29 12:30:16 -08:00
Jack Wright ead0ff3e53 Update completions.go
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
2024-11-29 12:30:16 -08:00
Jack Wright 3bfdd6421f Update completions.go
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
2024-11-29 12:30:16 -08:00
Jack Wright 4c4bde6586 "removing extra lines/whitespace" 2024-11-29 12:30:16 -08:00
Jack Wright 3b016843b9 "fixing completions that contain a /" 2024-11-29 12:30:16 -08:00
Jack Wright 247e8e6b55 "ignoring return value when directive is ShellComp#directiveFilterFileExt" 2024-11-29 12:30:16 -08:00
Jack Wright d86bac4e34 "fixing oddities with fuzzy searching and bug with active help" 2024-11-29 12:30:16 -08:00
Jack Wright fa746d4d5a Incorporating pull request feedback
- Fixing completion on full paths
- Fixing completion with equals in flags
- Fixing fuzzy search
- Typos
2024-11-29 12:30:16 -08:00
Jack Wright 37ac7454fb Added a whitelist to add cobra apps to to prevent non-cobra apps from
being excuted
2024-11-29 12:30:16 -08:00
Jack Wright 1324e0c316 Added nushell to the Use: line 2024-11-29 12:30:16 -08:00
Jack Wright 2f276e3014 Incorporating pull request feedback.
- Renamed completer to be cobra_completer to match docs
- Added whitespace after each completion
- Implemented ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp
- Disabled active help as it isn't supported by nushell
- Added nushell to the default completion command
2024-11-29 12:30:16 -08:00
Jack Wright 594faef23f Changed the nushell completion implementation to be a nushell external completer 2024-11-29 12:30:16 -08:00
Jack Wright a1431b2c57 'Completions for nushell' 2024-11-29 12:30:16 -08:00
Vui Lam 02326d52c0
Fix broken links in active_help.md (#2202)
Small change to fix a couple of broken links in active_help.md

Signed-off-by: Vui Lam <vui.lam@broadcom.com>
2024-11-05 06:19:24 -05:00
Leonhard Stemplinger 5a138f143f
Make Powershell completion script work in constrained mode (#2196)
Creating CompletionResult objects is not allowed in Powershell constrained mode, so return results as strings if constrained mode is enabled

Store results as PsCustomObjects instead of hashtables. This prevents Sort-Object from trying to convert the hashtable to a object, which is blocked in constrained mode.
PsCustomObjects are created using New-Object to work around https://github.com/PowerShell/PowerShell/issues/20767
2024-11-03 19:45:01 -05:00
Maxwel Mazur 3a5efaede9
doc: azion project added to the list of CLIs that use cobra (#2198) 2024-10-16 14:13:47 -04:00
Nir Soffer 5bef9d8d87
Fix --version help and output for plugins (#2180)
* Fix --version help with CommandDisplayNameAnnotation

When setting Command.Version, a --version option is added. The help
message for the --version command did not consider the command display
name:

    Flags:
      -h, --help      help for kubectl plugin
      -v, --version   version for kubectl-plugin

With this change the help test is consistent with other flags:

    Flags:
      -h, --help      help for kubectl plugin
      -v, --version   version for kubectl plugin

* Make command DisplayName() public

This allows using the display name in templates or other code that want
to use the same value.

* Use display name in version template

The version template used `{{.Name}}` but for plugins you want to use
`{{.DisplayName}}` to be consistent with other help output.

With this change will show:

    $ kubectl plugin --version
    kubectl plugin version 1.0.0
2024-10-12 12:08:27 -04:00
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
Ikko Eltociear Ashimine 11ab62158a
docs: update README.md (#2197)
minor fix
2024-10-11 06:40:47 -04:00
Nir Soffer 78bfc837fe
Test also with go 1.23 (#2182) 2024-08-24 19:02:44 -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
Gabe Cook 756ba6dad6
fix(completions): Complete map flags multiple times (#2174) 2024-07-28 12:18:07 -04:00
Sebastiaan van Stijn 371ae25d2c
Fix deprecation comment for Command.SetOutput (#2172)
Deprecation comments should be at the start of a paragraph [1], and because
of that have a whitespace above them [2];

> To signal that an identifier should not be used, add a paragraph to its
> doc comment that begins with Deprecated: followed by some information
> about the deprecation (...)

With the whitespace missing, some tools, including pkg.go.dev [3] don't
detect it to be deprecated.

[1]: https://go.dev/wiki/Deprecated
[2]: https://go.dev/doc/comment#paragraphs
[3]: https://pkg.go.dev/github.com/spf13/cobra@v1.8.1#Command.SetOutput

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-16 19:36:29 -04:00
Ville Skyttä e94f6d0dd9
Address golangci-lint deprecation warnings, enable some more linters (#2152)
* Address golangci-lint linter deprecation warnings

1.59.0 outputs:

WARN [lintersdb] The name "gas" is deprecated. The linter has been renamed to: gosec.
WARN [lintersdb] The linter named "megacheck" is deprecated. It has been split into: gosimple, staticcheck, unused.

* Enable some more linters, address finding
2024-06-01 06:31:11 -04:00
Nir Soffer 8003b74a10
Remove fully inactivated linters (#2148)
* Remove fully inactivated linters

Currently golangci-lint fails with these errors:

ERRO [linters_context] golint: This linter is fully inactivated: it will not produce any reports.
ERRO [linters_context] interfacer: This linter is fully inactivated: it will not produce any reports.
ERRO [linters_context] maligned: This linter is fully inactivated: it will not produce any reports.

I could not find any docs explaining what "fully inactivated" mean, but
based this PR[1] it seems that these linters do nothing now. Removing
the linters fixes this issue without changing linting, as they did not
produce any report.

Looking in the linters docs[2] I did not find a replacement for
"interfacer" and "malinged" linters. "stylecheck" seems to be a
replacement for "golint", but we need to fix the code to enable it.

[1] https://github.com/golangci/golangci-lint/pull/4436
[2] https://golangci-lint.run/usage/linters/

* Add stylecheck linter, replacement for golint

This revealed 2 capitalized error messages.

https://golangci-lint.run/usage/linters/#stylecheck
2024-05-18 22:12:02 -04:00
Nir Soffer 5c2c1d627d
Consistent annotation names (#2140)
Add `Annotation` suffix to the private annotations to allow nicer code
using the constants.

For example one can use the current annotation names as a temporary
variable instead of unclear shortcut. Instead of this:

    rag := flagsFromAnnotation(c, f, requiredAsGroup)
    me := flagsFromAnnotation(c, f, mutuallyExclusive)
    or := flagsFromAnnotation(c, f, oneRequired)

We can use now:

    requiredAsGrop := flagsFromAnnotation(c, f, requiredAsGroupAnnotation)
    mutuallyExclusive := flagsFromAnnotation(c, f, mutuallyExclusiveAnnotation)
    oneRequired := flagsFromAnnotation(c, f, oneRequiredAnnotation)

Example taken from #2105.
2024-05-18 09:41:31 -04:00
dependabot[bot] 5a1acea321
build(deps): bump github.com/cpuguy83/go-md2man/v2 from 2.0.3 to 2.0.4 (#2127) 2024-04-13 02:21:03 +00:00
Xinwei Xiong 0fc86c2ffd
docs: update user guide (#2128) 2024-04-08 06:47:35 -04:00
Ville Skyttä 6b5f577ebc
More linting (#2099)
* Address gocritic findings, enable it

* Enable gosimple, no new findings to address
2024-04-01 08:42:08 -04:00