1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-04 20:37:46 +02:00

cli: initial commit

this introduces the embd cli tool
This commit is contained in:
Karan Misra 2014-04-07 02:37:49 +05:30
parent c35deeb17c
commit ebfe2e5796
4 changed files with 73 additions and 2 deletions

1
embd/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
embd

28
embd/detect.go Normal file
View file

@ -0,0 +1,28 @@
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
"github.com/kidoman/embd"
)
func detect(c *cli.Context) {
host, rev, err := embd.DetectHost()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("detected host %v (rev %v)\n", host, rev)
}
var detectCmd = cli.Command{
Name: "detect",
Usage: "detect and display information about the host",
Action: detect,
}
func init() {
registerCommand(detectCmd)
}

26
embd/main.go Normal file
View file

@ -0,0 +1,26 @@
package main
import (
"os"
"github.com/codegangsta/cli"
_ "github.com/kidoman/embd/host/all"
)
var version = "0.1.0"
var commands []cli.Command
func registerCommand(cmd cli.Command) {
commands = append(commands, cmd)
}
func main() {
app := cli.NewApp()
app.Name = "embd"
app.Usage = "superheroic embedded utility belt"
app.Version = version
app.Commands = commands
app.Run(os.Args)
}