initial commit

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-10-18 10:54:39 -04:00
commit cffd33a055
Signed by: vbatts
GPG Key ID: 10937E57733F1362
1 changed files with 82 additions and 0 deletions

82
main.go Normal file
View File

@ -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
}