Skip to content

kevinburke/axiom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Axiom - Better CLI applications

An experimental set of tools to make it easier to build production command line applications.

import (
    "github.com/inconshreveable/axiom"
    "github.com/codegangsta/cli"
)

func main() {
    app := cli.NewApp()
    app.Name = "ctl"
    app.Usage = "control service"
    app.Commands = []cli.Command{
        {
            Name: "start",
            Action: func(c *cli.Context) {
                fmt.Println("starting service")
            },
        },
        {
            Name: "stop",
            Action: func(c *cli.Context) {
                fmt.Println("stopping service")
            },
        }
    }

    // Wrap all commands with:
    //  - flags to configure logging
    //  - custom crash handling
    //  - graceful handling of invocation from a GUI shell
    axiom.WrapApp(app, axiom.NewMousetrap(), axiom.NewLogged())

    // Use axiom to add version and update commands
    app.Commands = append(app.Commands,
        axiom.VersionCommand(),
        axiom.NewUpdater(equinoxAppId, updatePublicKey).Command(),
    )

    app.Run(os.Args)
}

About

utilities to build production command line apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%