Skip to content

Instantly share code, notes, and snippets.

@ToQoz
Created November 27, 2013 02:41
Show Gist options
  • Save ToQoz/7669864 to your computer and use it in GitHub Desktop.
Save ToQoz/7669864 to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"fmt"
"os"
)
func usage() {
banner := `toqoz is useless tool
Usage:
toqoz [sub-command]
The sub-commands are:
create
destroy
The options are:
`
fmt.Fprintf(os.Stderr, banner)
flag.PrintDefaults()
fmt.Fprintf(os.Stderr, "\n")
os.Exit(1)
}
func main() {
flag.Usage = usage
flag.Parse()
switch flag.Arg(0) {
case "create":
// do something
case "destroy":
// do something
default:
flag.Usage()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment