Created
November 27, 2013 02:41
-
-
Save ToQoz/7669864 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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