acmd alternatives and similar packages
Based on the "Standard CLI" category.
Alternatively, view acmd alternatives based on common mentions on social networks and blogs.
-
survey
DISCONTINUED. A golang library for building interactive and accessible prompts with full support for windows and posix terminals. -
The Platinum Searcher
A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings. -
flaggy
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies. -
flag
Flag is a simple but powerful command line option parsing library for Go support infinite level subcommand -
go-getoptions
Fully featured Go (golang) command line option parser with built-in auto-completion support. -
command-chain
A go library for easy configure and run command chains. Such like pipelining in unix shells. -
Go-Console
GoConsole: the golang component that eases the creation of beautiful command line interfaces.
SaaSHub - Software Alternatives and Reviews
Do you think we are missing an alternative of acmd or a related project?
Popular Comparisons
README
acmd
Simple, useful and opinionated CLI package in Go. For config loader see aconfig
Rationale
Popular CLI libraries (or better frameworks) have too large and unclear API, in most cases, you just want to define commands for your CLI application and run them without additional work. This package does this by providing a small API, good defaults and clear code.
Features
- Simple API.
- Dependency-free.
- Clean and tested code.
- Command aliases.
- Auto suggesting command.
- Builtin
help
andversion
commands.
See GUIDE.md for more details
Install
Go version 1.17+
go get github.com/cristalhq/acmd
Example
cmds := []acmd.Command{
{
Name: "now",
Description: "prints current time",
ExecFunc: func(ctx context.Context, args []string) error {
fmt.Printf("now: %s\n", now.Format("15:04:05"))
return nil
},
},
{
Name: "status",
Description: "prints status of the system",
ExecFunc: func(ctx context.Context, args []string) error {
// do something with ctx :)
return nil
},
},
}
// all the acmd.Config fields are optional
r := acmd.RunnerOf(cmds, acmd.Config{
AppName: "acmd-example",
AppDescription: "Example of acmd package",
Version: "the best v0.x.y",
// Context - if nil `signal.Notify` will be used
// Args - if nil `os.Args[1:]` will be used
// Usage - if nil default print will be used
})
if err := r.Run(); err != nil {
r.Exit(err)
}
Also see examples: examples_test.go.
Documentation
See these docs.
License
[MIT License](LICENSE).
*Note that all licence references and agreements mentioned in the acmd README section above
are relevant to that project's source code only.