Skip to content
/ go.cli Public

A command line interface framework

License

Notifications You must be signed in to change notification settings

hattya/go.cli

Repository files navigation

go.cli

A command line interface framework.

pkg.go.dev GitHub Actions Appveyor Codecov

Installation

$ go get -u github.com/hattya/go.cli

Usage

package main

import (
	"os"

	"github.com/hattya/go.cli"
)

var app = cli.NewCLI()

func main() {
	app.Version = "1.0"
	app.Usage = "<options> hello"
	app.Add(&cli.Command{
		Name: []string{"hello"},
		Action: func(ctx *cli.Context) error {
			ctx.UI.Println("Hello World!")
			return nil
		},
	})

	if err := app.Run(os.Args[1:]); err != nil {
		if _, ok := err.(cli.FlagError); ok {
			os.Exit(2)
		}
		os.Exit(1)
	}
}

License

go.cli is distributed under the terms of the MIT License.

About

A command line interface framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages