Crow is a Go library designed to create command-line applications in a simple and intuitive way using struct fields and tags. Inspired by projects like Commandeer, Crow aims to provide a more straightforward and "plug & play" solution for creating small applications or scripts, thereby reducing the complexity often associated with libraries like Cobra.
⚠️ Warning Crow is still in development. Consider it experimental.
Crow was developed to meet a specific need: the quick and simple creation of small command-line applications. Personally, I have often found myself creating scripts and small applications where libraries like Cobra introduced unnecessary complexity. Additionally, tools like Commandeer, which share a similar approach, seem to have lost some of their momentum in terms of maintenance. Crow was born to offer a simple and well-maintained alternative.
- Simplicity: Create CLI applications with minimal code and configuration.
- Use of Structs and Tags: Define your commands and options directly in Go structures with tags.
- Automatic Help Message Generation: Help messages for your commands are automatically generated, making it easier to document and use your application.
- Plug and Play: Designed to be easy to integrate and use without complex configuration.
- Ideal for Small Projects: Perfect for scripts and small applications where libraries like Cobra would be excessive.
✨ New Feature: You can create additional help topic.
To install Crow, use the go get command:
go get github.com/ARTSYS-H/crow/pkg/crowHere is a simple example to get started with Crow:
package main
import (
"github.com/ARTSYS-H/crow/pkg/crow"
)
type MyCommand struct {
Name string `help:"You Name"`
Age int `help:"Your age"`
}
func (mc *MyCommand) Run() error {
// Do your stuff here
}
func main() {
app := crow.New("App Name", "App Description")
command := &MyCommand{
Name: "Lucas",
Age: 27,
}
app.AddCommand(command, "Description of the command")
err = app.Execute(os.Args)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}- Structs and Tags: Define your commands and options as fields of a struct with tags to specify command-line options.
- crow.Execute: Use this function to parse command-line arguments.
Contributions are welcome! If you have suggestions, bug fixes, or improvements, feel free to open an issue or a pull request.
