main.go 720 B

1234567891011121314151617181920212223242526272829303132333435
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "github.com/pierrec/cmdflag"
  6. )
  7. const lz4Extension = ".lz4"
  8. func main() {
  9. flag.CommandLine.Bool(cmdflag.VersionBoolFlag, false, "print the program version")
  10. cli := cmdflag.New(nil)
  11. cli.MustAdd(cmdflag.Application{
  12. Name: "compress",
  13. Args: "[arguments] [<file name> ...]",
  14. Descr: "Compress the given files or from stdin to stdout.",
  15. Err: flag.ExitOnError,
  16. Init: Compress,
  17. })
  18. cli.MustAdd(cmdflag.Application{
  19. Name: "uncompress",
  20. Args: "[arguments] [<file name> ...]",
  21. Descr: "Uncompress the given files or from stdin to stdout.",
  22. Err: flag.ExitOnError,
  23. Init: Uncompress,
  24. })
  25. if err := cli.Parse(); err != nil {
  26. fmt.Println(err)
  27. return
  28. }
  29. }