Commit graph

1012 commits

Author SHA1 Message Date
Jun Nishimura f3125ff6fa define trueString constant 2023-07-15 00:56:13 +09:00
Jun Nishimura 46a2ba8c41 fix completion command: use PersistentPreRunE instead of PersistentPreRun 2023-07-14 23:50:49 +09:00
Jun Nishimura b370e7b9af fix help command: use PersistentPreRunE instead of PersistentPreRun 2023-07-14 23:50:21 +09:00
Jun Nishimura 3bb59c6775 add TestPersistentPreRunHooksForCompletionCommand 2023-07-14 00:39:35 +09:00
Jun Nishimura ba4e21df7a add TestPersistentPreRunHooksForHelpCommand 2023-07-14 00:39:10 +09:00
Jun Nishimura ef1328f8cf call Root PersistentPreRun on Completion Command 2023-07-14 00:38:29 +09:00
Jun Nishimura 2d1eeaf169 call Root PersitentPreRun on HelpCommand 2023-07-14 00:38:08 +09:00
Jun Nishimura 94a3cb1439 add PersistentPreRun for completion command
disable any persistent required flags for the completion command
2023-07-11 00:05:27 +09:00
Jun Nishimura 4b81cd58b2 add PersistentPreRun for help command
Disable any persistent required flags for the help command
2023-07-11 00:02:09 +09:00
Jun Nishimura 10b0388a6e add test to check required flags will be ignored for bash, zsh, fish, powershell completion 2023-07-09 16:12:28 +09:00
Jun Nishimura 314c9b86c2 add TestHelpCommandExecutedWithPersistentRequiredFlags 2023-07-09 16:11:47 +09:00
Jun Nishimura 43e4ad49f7 DisableFlagParsing in bash, zsh, fish, powershell set to true 2023-07-09 16:10:56 +09:00
Jun Nishimura 85e8097390 DisableFlagParsing in helpCommand set to true 2023-07-09 16:09:58 +09:00
Unai Martinez-Corral dcb405a939
Move documentation sources to site/content (#1428) 2023-06-20 17:15:36 -04:00
dependabot[bot] cbe4865373
build(deps): bump golangci/golangci-lint-action from 3.5.0 to 3.6.0 (#1976) 2023-06-20 20:46:35 +00:00
Paul Holzinger fdee73b4a0
powershell: escape variable with curly brackets (#1960)
This fixes an issue with program names that include a dot, in our case
`podman.exe`. This was caused by the change in commit 6ba7ebbc.

Fixes #1853

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-19 12:16:18 -04:00
Branch Vincent 988bd76139
test: make fish_completions_test more robust (#1980)
Use temporary files instead of assuming the current directory is
writable. Also, if creating a temporary file still returns an error,
prevent the test from failing silently by replacing `log.Fatal` with
`t.Fatal`.
2023-06-16 10:25:30 -04:00
Taavi Väänänen 2246fa82e9
Fix grammar: 'allows to' (#1978)
The use in generated bash completion files is getting flagged by
Lintian (the Debian package linting tool).

Signed-off-by: Taavi Väänänen <hi@taavi.wtf>
2023-06-13 11:12:49 -04:00
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
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
Seonghyeon Cho fdffa5a4c7
Update badge route (#1884)
Based on
https://github.com/badges/shields/issues/8671
2022-12-23 15:54:16 -05: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
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
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