From 9155320da83c4194daffe684793d749ae9a44436 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Mon, 21 Apr 2014 09:30:55 -0700 Subject: [PATCH] initial skeleton --- .gitignore | 2 ++ cli.go | 20 ++++++++++++++++++++ images.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 cli.go create mode 100644 images.go diff --git a/.gitignore b/.gitignore index 8365624..31a200c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ _testmain.go *.exe *.test + +dockviz* diff --git a/cli.go b/cli.go new file mode 100644 index 0000000..7a93567 --- /dev/null +++ b/cli.go @@ -0,0 +1,20 @@ +package main + +import ( + "os" + + "github.com/jessevdk/go-flags" +) + +type GlobalOptions struct { + // no options yet +} + +var globalOptions GlobalOptions +var parser = flags.NewParser(&globalOptions, flags.Default) + +func main() { + if _, err := parser.Parse(); err != nil { + os.Exit(1) + } +} diff --git a/images.go b/images.go new file mode 100644 index 0000000..cb99301 --- /dev/null +++ b/images.go @@ -0,0 +1,28 @@ +package main + +import "fmt" + +type ImagesCommand struct { + Dot bool `short:"d" long:"dot" description:"Show image information as Graphviz dot."` + Tree bool `short:"t" long:"tree" description:"Show image information as tree."` +} + +var imagesCommand ImagesCommand + +func (x *ImagesCommand) Execute(args []string) error { + + if imagesCommand.Dot { + fmt.Println("Output dot") + } else if imagesCommand.Tree { + fmt.Println("Output tree") + } + + return nil +} + +func init() { + parser.AddCommand("images", + "Visualize docker images.", + "", + &imagesCommand) +}