Commit graph

1060 commits

Author SHA1 Message Date
dependabot[bot] 0e3a0bfe91
build(deps): bump golangci/golangci-lint-action from 3.4.0 to 3.5.0 (#1971) 2023-06-12 02:39:30 +00:00
Tom Payne 284f410104
Fix typo in fish completions (#1945) 2023-04-08 00:47:33 -04:00
Marc Khouzam 4dd4b25de3
Update main image to better handle dark background (#1883)
Fixes #1880

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Co-authored-by: Deleplace <deleplace2015@gmail.com>
2023-03-22 18:41:51 -04:00
Marc Khouzam 45360a55cc
Allow sourcing zsh completion script (#1917)
Although it is not the recommended approach, sourcing a completion
script is the simplest way to get people to try using shell completion.
Not allowing it for zsh has turned out to complicate shell completion
adoption.  Further, many tools modify the zsh script to allow sourcing.

This commit allows sourcing of the zsh completion script.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
2023-03-22 18:41:05 -04:00
Luiz Carvalho c8a20a16ba
Document suggested layout for subcommands (#1930)
Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
2023-03-16 21:03:29 -04:00
Florent Poinsard b197a24504
Update projects_using_cobra.md (#1932)
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
2023-03-14 08:28:50 -04:00
Unai Martinez-Corral 9e6b58afc7
update copyright year (#1927) 2023-03-05 21:28:31 -05:00
Unai Martinez-Corral fb3652402b
ci: test Golang 1.20 (#1925) 2023-03-05 21:11:33 -05:00
Unai Martinez-Corral c7300f0bdd
ci: deprecate go 1.16 (#1926) 2023-03-05 21:07:19 -05:00
Oldřich Jedlička 567ea8ebc9
Add support for PowerShell 7.2+ (#1916)
PowerShell 7.2 has changed the way arguments are passed to executables.
This was originally an experimental feature in 7.2, but as of 7.3 it is
built-in. A simple "" is now sufficient for passing empty arguments, no
back-tick escaping is required.

Fixes #1849

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
Co-authored-by: Oldřich Jedlička <oldrich.jedlicka@rohlik.cz>
2023-02-25 16:30:37 -05:00
Gyanendra Mishra 3daa4b9c36
Add keeporder to shell completion (#1903)
This allows programs to request the shell to maintain the order of completions that was returned by the program
2023-02-25 15:57:12 -05:00
John McBride a516d4132c
Removes stale bot from GitHub action (#1908)
Signed-off-by: John McBride <jpmmcbride@gmail.com>
2023-02-13 20:49:03 -07:00
dependabot[bot] e839bb342f
build(deps): bump golangci/golangci-lint-action from 3.3.1 to 3.4.0 (#1902) 2023-02-12 01:27:13 +00:00
Ggg6542 87ebcd8f98
Update shell_completions.md (#1907)
align documentation with the code : completions.go:452
2023-02-08 21:11:53 -05:00
janhn 8b8ee8754c
Improve MarkFlagsMutuallyExclusive example in User Guide (#1904) 2023-02-06 06:15:40 -05:00
Shihta Kuan d022c0fe2b
Add documentation about disabling completion descriptions (#1901) 2023-01-30 12:58:20 -05:00
dependabot[bot] 4fa4fdf5cd
build(deps): bump github.com/inconshreveable/mousetrap (#1872) 2023-01-03 02:43:06 +00:00
Dominik Roos b4f979ae35
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.
2023-01-02 19:58:36 -05:00
Jack Wright 3c8715a6d7 "fixed whitespace" 2022-12-27 12:17:42 -08:00
Yash Ladha bf11ab6321
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
2022-12-25 15:08:39 -05:00
Jack Wright 303dd2517f "Reverted to old version without formatting changes and readded nushell" 2022-12-23 20:40:17 -08:00
Jack Wright cb60acd3ab "Added nushell to list of shell autompletes" 2022-12-23 20:39:54 -08:00
Jack Wright 107986cb5e
Update completions.go
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
2022-12-23 20:31:48 -08:00
Jack Wright 49d58810e6
Update completions.go
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
2022-12-23 20:31:38 -08:00
Jack Wright 6e3abc68be
Update completions.go
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>
2022-12-23 20:31:30 -08:00
Jack Wright cfee99c892 "removing extra lines/whitespace" 2022-12-23 20:30:18 -08:00
Seonghyeon Cho fdffa5a4c7
Update badge route (#1884)
Based on
https://github.com/badges/shields/issues/8671
2022-12-23 15:54:16 -05:00
Jack Wright b3a1d72b8b "fixing completions that contain a /" 2022-12-16 09:50:05 -08:00
Jack Wright fe8bf5e1bd "ignoring return value when directive is ShellComp#directiveFilterFileExt" 2022-12-16 09:32:22 -08:00
Jack Wright f366bb2799 "fixing oddities with fuzzy searching and bug with active help" 2022-12-15 13:23:38 -08:00
Yash Ladha f25a3c6e0b
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.
2022-12-15 05:39:50 -05:00
Unai Martinez-Corral 923592041e
ci: deprecate go 1.15 (#1866)
Remove testing for go 1.15 to allow CI to pass, but don't force projects to upgrade.
2022-12-09 16:57:19 -05:00
David Wertenteil a6f198b635
Update kubescape org (#1874)
Signed-off-by: David Wertenteil <dwertent@armosec.io>
2022-12-06 08:20:58 -05:00
Jack Wright 4ad4930a12 Incorporating pull request feedback
- Fixing completion on full paths
- Fixing completion with equals in flags
- Fixing fuzzy search
- Typos
2022-11-28 13:39:12 -08:00
Jack Wright 95f2d8e38a Added a whitelist to add cobra apps to to prevent non-cobra apps from
being excuted
2022-11-27 15:06:59 -08:00
Jack Wright 1c908e13f5 Added nushell to the Use: line 2022-11-27 13:55:50 -08:00
Jack Wright 0e4db1bd14 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
2022-11-27 13:46:13 -08:00
Jack Wright e687d2e9e1 Changed the nushell completion implementation to be a nushell external completer 2022-11-26 14:39:29 -08:00
dependabot[bot] 7bb1440003
build(deps): bump golangci/golangci-lint-action from 3.2.0 to 3.3.1 (#1851)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.2.0 to 3.3.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.2.0...v3.3.1)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-26 08:18:05 -05:00
Unai Martinez-Corral 6200c8e551
Makefile: add target richtest (#1865)
Don't require contributors to install richgo but keep it as an option and for CI
2022-11-25 15:55:09 -05:00
Norman Dankert c6b9971923
fix: force ForEach-Object to return array in pwsh completion (#1850)
Fixes #1847
2022-11-25 15:47:20 -05:00
Enrico Candino 430549841b
Update stale.yml (#1863) 2022-11-21 21:04:26 -05:00
Jack Wright 9f4bdb8eb8 'Completions for nushell' 2022-11-15 12:30:11 -08:00
Brian Pursley ad6db7f8f6
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.
2022-11-14 21:46:57 -05:00
Brian Pursley 6b0bd3076c
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 ignore flag values
when it searches for the X to exclude from the result.
2022-11-07 23:12:02 -05:00
mike76-dev cc7e235fc2
Add Sia to projects using Cobra (#1844) 2022-11-01 09:15:28 -04:00
Marc Khouzam 10cf7be997
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.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
2022-10-24 11:11:57 -04:00
doniacld 4b9d00dfec
Replace deprecated ExactValidArgs with MatchAll in user_guide and shell_completions example (#1836) 2022-10-20 16:33:37 -04:00
Ville Skyttä badcce14f8
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 variable is unset
or null in both cases; the former form is arguably easier on the eye.

* remove unnecessary trailing linefeed removal

No longer needed as of f464d6c82e, saves
a subshell.

* use herestring in activehelp extraction

Herestrings read cleaner than process substitutions, and work in posix
mode (but we do and will have some process substitutions so this doesn't
matter much). Both approaches may end up using temporary files.
2022-10-17 15:24:27 -04:00
Fabian Kammel 1424b7b927
Add Constellation to projects using cobra. (#1829) 2022-10-13 09:47:58 -04:00