cli - 一款简单、快速且有趣的构建命令行应用程序的 Go 语言包

jopen 9年前

cli - 一款简单、快速且有趣的构建命令行应用程序的 Go 语言包。它目标是让开发人员能够编写快速和分布式命令行应用。

Example

Being a programmer can be a lonely job. Thankfully by the power of automation that is not the case! Let's create a greeter app to fend off our demons of loneliness!

Start by creating a directory namedgreet, and within it, add a file,greet.gowith the following code in it:

package main    import (    "os"    "github.com/codegangsta/cli"  )    func main() {    app := cli.NewApp()    app.Name = "greet"    app.Usage = "fight the loneliness!"    app.Action = func(c *cli.Context) {      println("Hello friend!")    }      app.Run(os.Args)  }

项目主页:http://www.open-open.com/lib/view/home/1438222050035