DEV Community


Posted on • Updated on

Ezcli - Minimal Package for Creating CLI apps.

What is Ezcli?

Ezcli is a Go package for building CLI tools easily.


  • Initialize your project with go mod init <name>
  • Get Ezcli with go get

API Reference

Click here for API reference. ( sometime does not update package version, so use<latest version> for get the API reference for latest version.)

Source Code

Click here for source code.


Simple example for Ezcli.

package main

import (


func main() {
    handler := ezcli.CreateHandler() // Create handle function also gives built-in help command. So you dont need to write a help command yourself.

    // Adding a new command.
        Name:        "hello", // Command name.
        Description: "Say hello world!", // Command description.
        Options: []*ezcli.CommandOption{ // Command options (example: -force, -confirm etc...).
                Name:        "test", // Option name.
                Description: "A test command", // Option description.
        Execute: func(c *ezcli.Command) { // The function will run.
            fmt.Println("Hello Command!")

    handler.Handle() // Handle commands.

Enter fullscreen mode Exit fullscreen mode

Now lets compile our app with go build .

Time to test our app! Run the compiled app with ./<name> help

You should get the following result:

List of all commands. For more information, add a command name parameter to command.
  help | Built-in help command for application.
  hello | Say hello world!
Enter fullscreen mode Exit fullscreen mode

Lets test our hello command with ./<name> hello:

Hello Command!
Enter fullscreen mode Exit fullscreen mode

Congrats, you created your first app with Ezcli!


Found Bug? Issue? Please report at here. Or if you want to improve ezcli:

  • Fork the project from GitHub.
  • Make commits.
  • Open a pull-request and wait.

Top comments (0)