setup comamnd line argument parsing
This commit is contained in:
parent
237155552a
commit
70c0204128
3
browser.go
Normal file
3
browser.go
Normal file
@ -0,0 +1,3 @@
|
||||
package main
|
||||
|
||||
|
33
stations.go
33
stations.go
@ -1,12 +1,35 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println(api())
|
||||
fmt.Println(player())
|
||||
fmt.Println(options())
|
||||
fmt.Println(maxitems())
|
||||
fmt.Println("Configuration values:")
|
||||
fmt.Println("api url: ", api())
|
||||
fmt.Println("player command: ", player())
|
||||
fmt.Println("player options: ", options())
|
||||
fmt.Println("maximum menu items: ", maxitems())
|
||||
|
||||
argCount := len(os.Args[1:])
|
||||
|
||||
var (
|
||||
name string
|
||||
country string
|
||||
state string
|
||||
tags string
|
||||
)
|
||||
|
||||
flag.StringVar(&name, "n", "", "Station name (or identifier).")
|
||||
flag.StringVar(&country, "c", "", "Home country.")
|
||||
flag.StringVar(&state, "s", "", "Home state (if in the United States).")
|
||||
flag.StringVar(&tags, "t", "", "Tag (or comma-separated tag list)")
|
||||
flag.Parse()
|
||||
|
||||
if argCount == 0 {
|
||||
flag.Usage()
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user