Skip to content

titpetric/cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cli - A minimal CLI command package using pflag

Go Reference Coverage

This package contains the implementation for a minimal opinionated flags framework similar to spf13/cobra. It all centers around the cli.Command type but provides less functionality.

The package is low-dependency, only relying on the pflag package, to provide -- unix flag options.

This package is used in:

It's existed in some form for many years and I kept rewriting the CLIs to the next best thing, this exists for me to stop worring about flags like not an already solved problem. Reuse what works.

  • no environment handling (put it in default value with os.Getenv)
  • provide defaults with or without env support
  • scoped flagset bindings with Bind()
  • error handling, usage, help

The benchmark are tools like git, docker, docker compose, go where there is a mixture of command arguments (git status, git pull, ...) and flags like -d, --force. This package is the minimal shed in the back, the "cli package we have at home".

About

A minimal go package for CLI flags, uses pflag

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages