I'm trying to write a GNU-style command-line parser for Go, since the flags
package doesn't handle all these yet:
program -aAtGc --long-option-1 argument-to-1 --long-option-2 -- real-argument
Obviously, I don't want to use the flags
package, since I'm trying to replace it. Is there any other way to get to the command line?
Nevermind.
package main
import (
"fmt"
"os"
)
func main() {
args := os.Args
fmt.Printf("%d
", len(args))
for i := 0; i<len(args); i++ {
fmt.Printf("%s
", args[i])
}
}
The documentation is quite incomplete, though.