All Versions
48
Latest Version
Avg Release Cycle
12 days
Latest Release
1230 days ago

Changelog History
Page 5

  • v1.6.3 Changes

    November 01, 2019
    • v1.6.3

    support option value auto-expand with os environment variables.

    Relnotes

    • add WithNoColor, WithStrictMode, WithNoEnvOverrides
    • add WithLogex
    • add WithAfterArgsParsed
    • add DeleteKey
    • GetXXX() supports optional default value(s) now
    • add WithEnvVarMap
    • lint, doc, bugs fixed, and enable -race testing
    • add code owners file

    v1.6.3 WIP: Getxxx() with defaultValues; WithLogex(); WithAfterArgsParsed(fn); WithNoEnvOverrides(b); WithNoColor(b); WithStrictMode(b); DeleteKey(key);

  • v1.6.1 Changes

    October 10, 2019
    • ๐Ÿš€ The v1.6.1 released: those deprecated functions have been removed.
      This is a bug-fixed version on v1.6.0
  • v1.6.0

    October 10, 2019
  • v1.5.5 Changes

    October 08, 2019
    • ๐Ÿ—„ The v1.5.5 is last release that the DEPRECATED functions would be kept.

    THE DEPRECATED FUNCTIONS

    - Functions:
      1. AddOnBeforeXrefBuilding()
      1. AddOnAfterXrefBuilt()
      1. SetInternalOutputStreams()
      1. SetCustomShowVersion()
      1. SetCustomShowBuildInfo()
      1. PrintBuildInfo()
      1. SetNoLoadConfigFiles()
      1. SetCurrentHelpPainter()
      1. SetHelpTabStop()
      1. ExecWith()
      1. SetUnknownOptionHandler()
      1. SetInternalOutputStreams()
      1. daemon.Enable()
    
    - Global Variables:
      1. EnableVersionCommands
      1. EnableHelpCommands
      1. EnableVerboseCommands
      1. EnableCmdrCommands
      1. EnableGenerateCommands
      1. EnvPrefix
      1. RxxtPrefix
      1. ShouldIgnoreWrongEnumValue
    

    wget-demo at playground: https://play.golang.org/p/wpEZgQGzKyt demo with daemon plugin: https://play.golang.org/p/wJUA59uGu2M

  • v1.5.3

    October 05, 2019
  • v1.5.1

    October 05, 2019
  • v1.5.0 Changes

    October 04, 2019
    • ๐Ÿ’… Since v1.5.0, main entry Exec() uses With Functional Options style too:

    Expand to source codes

      err := cmdr.Exec(rootCmd,
            cmdr.WithXrefBuildingHooks(func(root *cmdr.RootCommand, args []string) {}, func(root *cmdr.RootCommand, args []string) {}),
            cmdr.WithAutomaticEnvHooks(func(root *cmdr.RootCommand, opts *cmdr.Options) {}),
            cmdr.WithEnvPrefix("CMDR"), // WithEnvPrefix("F","YY") == T_YY_xxx
            cmdr.WithOptionsPrefix("app"), // cmdr.WithRxxtPrefix("app"),
            cmdr.WithPredefinedLocations(nil),
            cmdr.WithIgnoreWrongEnumValue(true),
            cmdr.WithBuiltinCommands(true, true, true, true, true),
            cmdr.WithInternalOutputStreams(nil, nil),
            cmdr.WithCustomShowVersion(func() {}),
            cmdr.WithCustomShowBuildInfo(func() {}),
            cmdr.WithNoLoadConfigFiles(false),
            cmdr.WithHelpPainter(nil),
            cmdr.WithConfigLoadedListener(nil),
            cmdr.WithHelpTabStop(70),
            cmdr.WithUnknownOptionHandler(func(isFlag bool, title string, cmd *cmdr.Command, args []string) (fallbackToDefaultDetector bool) {
                    return true
            }), // since v1.5.5
            cmdr.WithSimilarThreshold(0.73), // since v1.5.5
            cmdr.WithNoColor(true), // since v1.6.2
            cmdr.WithNoEnvOverrides(true), // since v1.6.2
            cmdr.WithStrictMode(true), // since v1.6.2
        )
    
  • v1.0.x Changes

    • Since v1.0.3, we added compatibilities for migrating from go flag:

    Migrate to cmdr from go flag

      // old code
    
      package main
    
      import "flag"
    
      var (
        serv           = flag.String("service", "hello_service", "service name")
        host           = flag.String("host", "localhost", "listening host")
        port           = flag.Int("port", 50001, "listening port")
        reg            = flag.String("reg", "localhost:32379", "register etcd address")
        count          = flag.Int("count", 3, "instance's count")
        connectTimeout = flag.Duration("connect-timeout", 5*time.Second, "connect timeout")
      )
    
      func main(){
          flag.Parse()
          // ...
      }
    

    to migrate it to cmdr, just replace the import line with:

      import (
        // flag
        "github.com/hedzr/cmdr/flag"
      )
    
      var (
        serv           = flag.String("service", "hello_service", "service name")
        host           = flag.String("host", "localhost", "listening host")
        port           = flag.Int("port", 50001, "listening port")
        reg            = flag.String("reg", "localhost:32379", "register etcd address")
        count          = flag.Int("count", 3, "instance's count")
        connectTimeout = flag.Duration("connect-timeout", 5*time.Second, "connect timeout")
      )
    
      func main(){
          flag.Parse()
          // ...
      }
    

    if you wanna use the new features from cmdr, try Withxxx:

      import (
        // flag
        "github.com/hedzr/cmdr"
        "github.com/hedzr/cmdr/flag"
      )
    
      var (
          // uncomment this line if you like long opt (such as --service)
          //treatAsLongOpt = flag.TreatAsLongOpt(true)
    
          serv = flag.String("service", "hello_service", "service name",
            flag.WithAction(func(cmd *cmdr.Command, args []string) (err error) {
                return
            }))
          // ...
          // WithTitles, WithShort, WithLong, WithAliases, 
          // WithDescription, WithExamples, WithHidden, 
          // WithGroup, WithDeprecated, WithToggleGroup,
          // WithAction, WithDefaultValue, 
          // WithValidArgs, WithHeadLike, WithExternalTool, 
          // ...
      )