Skip to content

Releases: spf13/cobra

v1.10.1

01 Sep 16:32
7da941c
Compare
Choose a tag to compare

πŸ› Fix

v1.0.9 of pflags brought back ParseErrorsWhitelist and marked it as deprecated

Full Changelog: v1.10.0...v1.10.1

v1.10.0

01 Sep 13:39
51d6751
Compare
Choose a tag to compare

What's Changed

🚨 Attention!

This version of pflag carried a breaking change: it renamed ParseErrorsWhitelist to ParseErrorsAllowlist which can break builds if both pflag and cobra are dependencies in your project.

  • If you use both pflag and cobra, upgrade pflagto 1.0.8 andcobrato1.10.0`
  • or use the newer, fixed version of pflag v1.0.9 which keeps the deprecated ParseErrorsWhitelist

More details can be found here: #2303 (comment)

✨ Features

  • Flow context to command in SetHelpFunc by @Frassle in #2241
  • The default ShellCompDirective can be customized for a command and its subcommands by @albers in #2238

πŸ› Fix

  • Upgrade golangci-lint to v2, address findings by @scop in #2279

πŸͺ  Testing

πŸ“ Docs

New Contributors

Full Changelog: v1.9.1...v1.9.2

v1.9.1

16 Feb 23:54
40b5bc1
Compare
Choose a tag to compare

πŸ› Fixes

Full Changelog: v1.9.0...v1.9.1

v1.9.0

15 Feb 18:28
5f9c408
Compare
Choose a tag to compare

✨ Features

  • Allow linker to perform deadcode elimination for program using Cobra by @aarzilli in #1956
  • Add default completion command even if there are no other sub-commands by @marckhouzam in #1559
  • Add CompletionWithDesc helper by @ccoVeille in #2231

πŸ› Fixes

πŸ€– Completions

  • Make Powershell completion work in constrained mode by @lstemplinger in #2196
  • Improve detection for flags that accept multiple values by @thaJeztah in #2210
  • add CompletionFunc type to help with completions by @ccoVeille in #2220
  • Add similar whitespace escape logic to bash v2 completions than in other completions by @kangasta in #1743
  • Print ActiveHelp for bash along other completions by @marckhouzam in #2076
  • fix(completions): Complete map flags multiple times by @gabe565 in #2174
  • fix(bash): nounset unbound file filter variable on empty extension by @scop in #2228

πŸ§ͺ Testing

✍🏼 Documentation

πŸ”§ Dependency upgrades


Thank you to all of our amazing contributors and all the great work that's been going into the completions feature!!

πŸ‘‹πŸΌ New Contributors

Full Changelog: v1.8.1...v1.9.0

v1.8.1

14 Jun 20:55
e94f6d0
Compare
Choose a tag to compare

✨ Features

  • Add env variable to suppress completion descriptions on create by @scop in #1938

πŸ› Bug fixes

πŸ”§ Maintenance

  • build(deps): bump github.com/cpuguy83/go-md2man/v2 from 2.0.3 to 2.0.4 by @dependabot in #2127
  • Consistent annotation names by @nirs in #2140
  • Remove fully inactivated linters by @nirs in #2148
  • Address golangci-lint deprecation warnings, enable some more linters by @scop in #2152

πŸ§ͺ Testing & CI/CD

✏️ Documentation

New Contributors


Thank you everyone who contributed to this release and all your hard work! Cobra and this community would never be possible without all of you!!!! 🐍

Full Changelog: v1.8.0...v1.8.1

v1.8.0

04 Nov 21:06
a0a6ae0
Compare
Choose a tag to compare

✨ Features

  • Support usage as plugin for tools like kubectl by @nirs in #2018 - this means that programs that utilize a "plugin-like" structure have much better support and usage (like for completions, command paths, etc.)
  • Move documentation sources to site/content by @umarcor in #1428
  • Add 'one required flag' group by @marevers in #1952 - this includes a new MarkFlagsOneRequired API for flags which can be used to mark a flag group as required and cause command failure if at least one is not used when invoked.
  • Customizable error message prefix by @5ouma in #2023 - This adds the SetErrPrefix and ErrPrefix APIs on the Command struct to allow for setting a custom prefix for errors
  • feat: add getters for flag completions by @avirtopeanu-ionos in #1943
  • Feature: allow running persistent run hooks of all parents by @vkhoroz in #2044
  • Improve API to get flag completion function by @marckhouzam in #2063

πŸ› Bug fixes

πŸ”§ Maintenance

πŸ§ͺ Testing & CI/CD

✏️ Documentation

  • doc: fix typo, Deperecated -> Deprecated by @callthingsoff in #2000
  • Add notes to doc about the execution condition of *PreRun and *PostRun functions by @haoming29 in #2041

Thank you everyone who contributed to this release and all your hard work! Cobra and this community would never be possible without all of you!!!! 🐍

Full Changelog: v1.7.0...v1.8.0

v1.7.0

04 Apr 14:43
4dd4b25
Compare
Choose a tag to compare

✨ Features

πŸ› Bug fixes

πŸ§ͺ Testing & CI/CD

πŸ”§ Maintenance

✏️ Documentation


This release contains several long running fixes, improvements to powershell completions, and further optimizations for completions.

Thank you everyone who contributed to this release and all your hard work! Cobra and this community would never be possible without all of you! 🐍

Full changelog: v1.6.1...v1.7.0

v1.6.1

24 Oct 23:03
b43be99
Compare
Choose a tag to compare

Bug fixes πŸ›

  • Fixes a panic when AddGroup isn't called before AddCommand(my-sub-command) is executed. This can happen within more complex cobra file structures that have many different inits to be executed. Now, the check for groups has been moved to ExecuteC and provides more flexibility when working with grouped commands - @marckhouzam (and shout out to @aawsome, @andig and @KINGSABRI for a deep investigation into this! πŸ‘πŸΌ)

v1.6.0

11 Oct 15:37
8607918
Compare
Choose a tag to compare

Summer 2022 Release

Some exciting changes make their way to Cobra! Command completions continue to get better and better (including adding --help and --version automatic flags to the completions list). Grouping is now possible in your help output as well! And you can now use the OnFinalize method to cleanup things when all "work" is done. Checkout the full changelog below:


Features 🌠

Deprecation πŸ‘ŽπŸΌ

  • ExactValidArgs is deprecated (but not being removed entirely). This is abit nuanced, so checkout #1643 for further information and the updated user_guide.md on how this may affect you (and how you can take advantage of the correct behavior in the validators): @umarcor #1643

Bug fixes πŸ›

  • Fix (bash-v2) activeHelp length check syntax: @scop #1762
  • Fix correct command path in see_also for yaml documentation: @zregvart #1771
  • Fix showing flags that shadow parent persistent flag in child help messaging: @brianpursley #1776

Dependencies πŸ—³οΈ

Testing πŸ€”

Docs ✏️

Misc πŸ’­

Note: Per #1804, we will be moving away from "seasonal" releases and doing more generic point release targets. Continue to track the milestones and issues in the spf13/cobra GitHub repository for more information!

Great work everyone! Cobra would never be possible without your contributions! 🐍

Full Changelog: v1.5.0...v1.6.0

v1.5.0

21 Jun 02:37
06b06a9
Compare
Choose a tag to compare

Spring 2022 Release πŸŒ₯️

Hello everyone! Welcome to another release of cobra. Completions continue to get better and better. This release adds a few really cool new features. We also continue to patch versions of our dependencies as they become available via dependabot. Happy coding!

Active help πŸ‘πŸΌ

Shout out to @marckhouzam for a big value add: Active Help #1482. With active help, a program can provide some inline warnings or hints for users as they hit tab. Now, your CLIs can be even more intuitive to use!

Currently active help is only supported for bash V2 and zsh. Marc wrote a whole guide on how to do this, so make sure to give it a good read to learn how you can add this to your cobra code! https://github.com/spf13/cobra/blob/master/active_help.md

Group flags πŸ§‘πŸΌβ€πŸ€β€πŸ§‘πŸΌ

Cobra now has the ability to mark flags as required or exclusive as a group. Shout out to our newest maintainer @johnSchnake for this! #1654 Let's say you have a username flag that MUST be partnered with a password flag. Well, now, you can enforce those as being required together:

rootCmd.Flags().StringVarP(&u, "username", "u", "", "Username (required if password is set)")
rootCmd.Flags().StringVarP(&pw, "password", "p", "", "Password (required if username is set)")
rootCmd.MarkFlagsRequiredTogether("username", "password")

Flags may also be marked as "mutally exclusive" with the MarkFlagsMutuallyExclusive(string, string ... ) command API. Refer to our user guide documentation for further info!

Completions πŸ‘€

  • Add backwards-compatibility tests for legacyArgs() by @marckhouzam in #1547
  • feat: Add how to load completions in your current zsh session by @ondrejsika in #1608
  • Introduce FixedCompletions by @emersion in #1574
  • Add shell completion to flag groups by @marckhouzam in #1659
  • Modify brew prefix path in macOS system by @imxw in #1719
  • perf(bash-v2): use backslash escape string expansion for tab by @scop in #1682
  • style(bash-v2): out is not an array variable, do not refer to it as such by @scop in #1681
  • perf(bash-v2): standard completion optimizations by @scop in #1683
  • style(bash): out is not an array variable, do not refer to it as such by @scop in #1684
  • perf(bash-v2): short-circuit descriptionless candidate lists by @scop in #1686
  • perf(bash-v2): speed up filtering entries with descriptions by @scop in #1689
  • perf(bash-v2): speed up filtering menu-complete descriptions by @scop in #1692
  • fix(bash-v2): skip empty completions when filtering descriptions by @scop in #1691
  • perf(bash-v2): read directly to COMPREPLY on descriptionless short circuit by @scop in #1700
  • fix: Don't complete _command on zsh by @twpayne in #1690
  • Improve fish_completions code quality by @t29kida in #1515
  • Fix handling of descriptions for bash v3 by @marckhouzam in #1735
  • undefined or nil Args default to ArbitraryArgs by @umarcor in #1612
  • Add Command.SetContext by @joshcarp in #1551
  • Wrap printf tab with quotes by @PapaCharlie in #1665

Documentation πŸ“

Testing & CI βš™οΈ

Beep boop, bot commits πŸ€–

Misc πŸ’­

Shoutout to ALL our contributors (and all the new first time contributors!!) - great work everyone!! Cobra and it's huge impact wouldn't be possible without you πŸ‘πŸΌ πŸš€ 🐍

Full Changelog: v1.4.0...v1.5.0