From cffd33a0559c227a0679ee7d36d54109f0006ccc Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 18 Oct 2018 10:54:39 -0400 Subject: [PATCH] initial commit Signed-off-by: Vincent Batts --- main.go | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..cd51912 --- /dev/null +++ b/main.go @@ -0,0 +1,82 @@ +package main + +import ( + "os" + + "github.com/urfave/cli" +) + +func main() { + app := cli.NewApp() + app.Name = "gogzip" + app.Description = "golang `compress/gzip` cli, in likeness to GNU gzip" + app.Version = "0.1" + app.Flags = []cli.Flag{ + cli.BoolFlag{ + Name: "a,ascii", + Usage: "(noop here for compatibility)", + }, + cli.BoolFlag{ + Name: "c,stdout,to-stdout", + Usage: "write output to stdout", + }, + cli.BoolFlag{ + Name: "d", + Usage: "decompress", + }, + cli.BoolFlag{ + Name: "f,force", + Usage: "force", + }, + cli.BoolFlag{ + Name: "k,keep", + Usage: "keep original file when compressing", + }, + cli.BoolFlag{ + Name: "l,list", + Usage: "for each compressed file, list the size tables", + }, + cli.BoolFlag{ + Name: "L,license", + Usage: "license", + }, + cli.BoolFlag{ + Name: "N,name", + Usage: "license", + }, + cli.BoolFlag{ + Name: "q,quiet", + Usage: "suppress warnings", + }, + cli.BoolFlag{ + Name: "r,recursive", + Usage: "if any of the file arguments are directories, recurse them", + }, + cli.StringFlag{ + Name: "S,suffix", + Value: ".gz", + Usage: "when compressing use suffix value instead of default", + }, + cli.BoolFlag{ + Name: "synchronous", + Usage: "sync", + }, + cli.BoolFlag{ + Name: "#,best,fast", + Usage: "compression level", + }, + cli.BoolFlag{ + Name: "rsyncable", + Usage: "rsyncable", + }, + cli.VersionFlag, + } + app.Action = defaultAction + app.Run(os.Args) +} + +func defaultAction(c *cli.Context) error { + // TODO check whether stdin or its a pty terminal, if no args + + return nil +}