Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update cobra #1

Merged
merged 54 commits into from Mar 15, 2024
Merged

feat: update cobra #1

merged 54 commits into from Mar 15, 2024

Commits on Nov 15, 2022

  1. Create unit test illustrating unknown flag bug (spf13#1854)

    Created a unit test that tests the unknown flag
    error message when the unknown flag is located
    in different arg positions.
    brianpursley committed Nov 15, 2022
    Copy the full SHA
    ad6db7f View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2022

  1. Copy the full SHA
    4305498 View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2022

  1. Copy the full SHA
    c6b9971 View commit details
    Browse the repository at this point in the history
  2. Makefile: add target richtest (spf13#1865)

    Don't require contributors to install richgo but keep it as an option and for CI
    umarcor committed Nov 25, 2022
    Copy the full SHA
    6200c8e View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2022

  1. build(deps): bump golangci/golangci-lint-action from 3.2.0 to 3.3.1 (s…

    …pf13#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](golangci/golangci-lint-action@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>
    dependabot[bot] committed Nov 26, 2022
    Copy the full SHA
    7bb1440 View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2022

  1. Update kubescape org (spf13#1874)

    Signed-off-by: David Wertenteil <dwertent@armosec.io>
    dwertent committed Dec 6, 2022
    Copy the full SHA
    a6f198b View commit details
    Browse the repository at this point in the history

Commits on Dec 9, 2022

  1. ci: deprecate go 1.15 (spf13#1866)

    Remove testing for go 1.15 to allow CI to pass, but don't force projects to upgrade.
    umarcor committed Dec 9, 2022
    Copy the full SHA
    9235920 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2022

  1. fix: conflict import name with variable (spf13#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.
    yashLadha committed Dec 15, 2022
    Copy the full SHA
    f25a3c6 View commit details
    Browse the repository at this point in the history

Commits on Dec 23, 2022

  1. Update badge route (spf13#1884)

    sh-cho committed Dec 23, 2022
    Copy the full SHA
    fdffa5a View commit details
    Browse the repository at this point in the history

Commits on Dec 25, 2022

  1. fix: func name in doc strings (spf13#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
    yashLadha committed Dec 25, 2022
    Copy the full SHA
    bf11ab6 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2023

  1. completions: do not detect arguments with dash as 2nd char as flag (s…

    …pf13#1817)
    
    Fixes spf13#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.
    oncilla committed Jan 3, 2023
    Copy the full SHA
    b4f979a View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    4fa4fdf View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2023

  1. Copy the full SHA
    d022c0f View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2023

  1. Copy the full SHA
    8b8ee87 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2023

  1. Update shell_completions.md (spf13#1907)

    align documentation with the code : completions.go:452
    gusega committed Feb 9, 2023
    Copy the full SHA
    87ebcd8 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2023

  1. Copy the full SHA
    e839bb3 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2023

  1. Removes stale bot from GitHub action (spf13#1908)

    Signed-off-by: John McBride <jpmmcbride@gmail.com>
    jpmcb committed Feb 14, 2023
    Copy the full SHA
    a516d41 View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2023

  1. Add keeporder to shell completion (spf13#1903)

    This allows programs to request the shell to maintain the order of completions that was returned by the program
    h4ck3rk3y committed Feb 25, 2023
    Copy the full SHA
    3daa4b9 View commit details
    Browse the repository at this point in the history
  2. Add support for PowerShell 7.2+ (spf13#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 spf13#1849
    
    Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
    Co-authored-by: Oldřich Jedlička <oldrich.jedlicka@rohlik.cz>
    oldium and Oldřich Jedlička committed Feb 25, 2023
    Copy the full SHA
    567ea8e View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2023

  1. Copy the full SHA
    c7300f0 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    fb36524 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    9e6b58a View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2023

  1. Update projects_using_cobra.md (spf13#1932)

    Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
    frouioui committed Mar 14, 2023
    Copy the full SHA
    b197a24 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2023

  1. Document suggested layout for subcommands (spf13#1930)

    Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
    lcarva committed Mar 17, 2023
    Copy the full SHA
    c8a20a1 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2023

  1. Allow sourcing zsh completion script (spf13#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>
    marckhouzam committed Mar 22, 2023
    Copy the full SHA
    45360a5 View commit details
    Browse the repository at this point in the history
  2. Update main image to better handle dark background (spf13#1883)

    Fixes spf13#1880
    
    Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
    Co-authored-by: Deleplace <deleplace2015@gmail.com>
    marckhouzam and Deleplace committed Mar 22, 2023
    Copy the full SHA
    4dd4b25 View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2023

  1. Copy the full SHA
    284f410 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2023

  1. Copy the full SHA
    0e3a0bf View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2023

  1. Fix grammar: 'allows to' (spf13#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>
    supertassu committed Jun 13, 2023
    Copy the full SHA
    2246fa8 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2023

  1. test: make fish_completions_test more robust (spf13#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`.
    branchvincent committed Jun 16, 2023
    Copy the full SHA
    988bd76 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2023

  1. powershell: escape variable with curly brackets (spf13#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 6ba7ebb.
    
    Fixes spf13#1853
    
    Signed-off-by: Paul Holzinger <pholzing@redhat.com>
    Luap99 committed Jun 19, 2023
    Copy the full SHA
    fdee73b View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2023

  1. Copy the full SHA
    cbe4865 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    dcb405a View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2023

  1. Copy the full SHA
    c81c46a View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2023

  1. Copy the full SHA
    66b215b View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2023

  1. Copy the full SHA
    60d056d View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2023

  1. Copy the full SHA
    fd865a4 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2023

  1. Copy the full SHA
    4955da7 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2023

  1. Copy the full SHA
    285460d View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2023

  1. Copy the full SHA
    c5dacb3 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    0c72800 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2023

  1. Copy the full SHA
    bd4d165 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2023

  1. Copy the full SHA
    95d8a1e View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2023

  1. Copy the full SHA
    efe8fa3 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. Copy the full SHA
    5c962a2 View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2023

  1. Allow running persistent run hooks of all parents (spf13#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:
    - spf13#216
    - spf13#252
    
    Signed-off-by: Volodymyr Khoroz <volodymyr.khoroz@foundries.io>
    vkhoroz committed Oct 22, 2023
    Copy the full SHA
    4cafa37 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2023

  1. Fix linter errors (spf13#2052)

    When using golangci-lint v1.55.0 some new errors were being reported.
    
    Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
    marckhouzam committed Oct 27, 2023
    Copy the full SHA
    8b1eba4 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2023

  1. Don't complete --help flag when flag parsing disabled (spf13#2061)

    Fixes spf13#2060
    
    When a command sets `DisableFlagParsing = true` it requests the
    responsibility of doing all the flag parsing. Therefore even the
    `--help/-f/--version/-v` flags should not be automatically completed
    by Cobra in such a case.
    
    Without this change the `--help/-h/--version/-v` flags can end up being
    completed twice for plugins: one time from cobra and one time from the
    plugin (which has set `DisableFlagParsing = true`).
    
    Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
    marckhouzam committed Oct 28, 2023
    Copy the full SHA
    b711e87 View commit details
    Browse the repository at this point in the history
  2. Add tests for flag completion registration (spf13#2053)

    Different problems have been reported about flag completion registration.
    These two tests are the cases that were not being verified but had been
    mentioned as problematic.
    
    Ref:
    - spf13#1320
    - spf13#1438 (comment)
    
    Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
    marckhouzam committed Oct 28, 2023
    Copy the full SHA
    00b68a1 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2023

  1. Replace all non-alphanumerics in active help env var program prefix (s…

    …pf13#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
    scop committed Oct 29, 2023
    Copy the full SHA
    22953d8 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Copy the full SHA
    48cea5c View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2023

  1. Support usage as plugin for tools like kubectl (spf13#2018)

    In this case the executable is `kubectl-plugin`, but we run it as:
    
        kubectl plugin
    
    And the help text should reflect the actual usage of the command.
    
    To create a plugin, add the cobra.CommandDisplayNameAnnotation:
    
        rootCmd := &cobra.Command{
            Use: "plugin",
            Annotations: map[string]string{
                cobra.CommandDisplayNameAnnotation: "kubectl plugin",
            }
        }
    
    Internally this change modifies CommandPath() for the root command to
    return the command display name instead of the command name. This is
    used for error messages, help text generation, and completions.
    
    CommandPath() is expected to have spaces and code using it already
    handle spaces (e.g replacing with _), so hopefully this does not break
    anything.
    
    Fixes: spf13#2017
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
    nirs committed Nov 2, 2023
    Copy the full SHA
    890302a View commit details
    Browse the repository at this point in the history
  2. Improve API to get flag completion function (spf13#2063)

    The new API is simpler and matches the `c.RegisterFlagCompletionFunc()`
    API.  By removing the global function `GetFlagCompletion()` we are more
    future proof if we ever move from a global map of flag completion
    functions to something associated with the command.
    
    The commit also makes this API work with persistent flags by using
    `c.Flag(flagName)` instead of `c.Flags().Lookup(flagName)`.
    
    The commit also adds unit tests.
    
    Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
    marckhouzam committed Nov 2, 2023
    Copy the full SHA
    a0a6ae0 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2024

  1. feat: expose GetCompletions (was getCompletions)

    gfyrag authored and David Ragot committed Mar 15, 2024
    Copy the full SHA
    bfd8d9b View commit details
    Browse the repository at this point in the history