Goofing around with command line flag scanning
This commit is contained in:
31
farse/cmd/farse-test/main.go
Normal file
31
farse/cmd/farse-test/main.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
farse "../.."
|
||||
)
|
||||
|
||||
func main() {
|
||||
fl := farse.New()
|
||||
err := fl.AddKnown(
|
||||
"-a", "-n", "-q", "-m",
|
||||
"--azimuth", "--noodle", "--quince",
|
||||
"whoop", "fizzle", "flim",
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println("known:")
|
||||
for key, tokType := range fl.Known() {
|
||||
fmt.Printf(" %v: %s\n", key, tokType)
|
||||
}
|
||||
|
||||
fmt.Println("scanned:")
|
||||
for _, tok := range fl.Scan(os.Args) {
|
||||
fmt.Printf(" %v: %s\n", tok.Value, tok.Type)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user