|
@@ -457,11 +457,15 @@ show - under windows ? :cat_scream:
|
|
|
*/
|
|
|
|
|
|
func main() {
|
|
|
- if len(os.Args) == 1 {
|
|
|
- fmt.Println("Usage: font-out <command> [<args>] fontfile.tdf...")
|
|
|
+ var usage func() = func() {
|
|
|
+ fmt.Println("Usage: font-util <command> [<args>] fontfile.tdf...")
|
|
|
fmt.Println(" list - List available fonts")
|
|
|
fmt.Println(" show - Show fonts")
|
|
|
fmt.Println(" extract - Extract to source.go file")
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(os.Args) == 1 {
|
|
|
+ usage()
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -490,6 +494,7 @@ func main() {
|
|
|
listCommand.Parse(os.Args[2:])
|
|
|
if listCommand.Parsed() {
|
|
|
if len(listCommand.Args()) == 0 {
|
|
|
+ listCommand.Usage()
|
|
|
fmt.Println("No TDF Font files given.")
|
|
|
os.Exit(2)
|
|
|
}
|
|
@@ -507,6 +512,7 @@ func main() {
|
|
|
extractCommand.Parse(os.Args[2:])
|
|
|
|
|
|
default:
|
|
|
+ usage()
|
|
|
fmt.Printf("%q is not a valid command.\n", os.Args[1])
|
|
|
os.Exit(2)
|
|
|
}
|
|
@@ -526,14 +532,14 @@ func main() {
|
|
|
if showCommand.Parsed() {
|
|
|
// Show Fonts
|
|
|
if len(fontList) == 0 {
|
|
|
- fmt.Println("No Fonts selected.")
|
|
|
showCommand.Usage()
|
|
|
+ fmt.Println("No Fonts selected.")
|
|
|
os.Exit(2)
|
|
|
}
|
|
|
|
|
|
if len(showCommand.Args()) == 0 {
|
|
|
- fmt.Println("No TDF Fonts files given.")
|
|
|
showCommand.Usage()
|
|
|
+ fmt.Println("No TDF Fonts files given.")
|
|
|
os.Exit(2)
|
|
|
}
|
|
|
|
|
@@ -546,14 +552,14 @@ func main() {
|
|
|
if extractCommand.Parsed() {
|
|
|
// Extract Fonts
|
|
|
if len(fontList) == 0 {
|
|
|
- fmt.Println("No Fonts selected.")
|
|
|
extractCommand.Usage()
|
|
|
+ fmt.Println("No Fonts selected.")
|
|
|
os.Exit(2)
|
|
|
}
|
|
|
|
|
|
if len(extractCommand.Args()) == 0 {
|
|
|
- fmt.Println("No TDF Fonts files given.")
|
|
|
extractCommand.Usage()
|
|
|
+ fmt.Println("No TDF Fonts files given.")
|
|
|
os.Exit(2)
|
|
|
}
|
|
|
|