diff --git a/0flags.go b/0flags.go new file mode 100644 index 0000000..76636ea --- /dev/null +++ b/0flags.go @@ -0,0 +1,32 @@ +package main + +import ( + "flag" + "runtime" +) + +func defaultFaceSize() int { + switch runtime.GOOS { + case "darwin": + return 13 + default: + return 11 + } +} + +var ( + utf8 = flag.Bool("u", false, "enable utf8 experiment") + elastic = flag.Bool("elastic", false, "enable elastic tabstops") + oled = flag.Bool("b", false, "OLED display mode (black)") + ftsize = flag.Int("ftsize", defaultFaceSize(), "font size") + srvaddr = flag.String("l", "", "(dangerous) announce and serve file system clients on given endpoint") + clientaddr = flag.String("d", "", "dial to a remote file system on endpoint") + quiet = flag.Bool("q", false, "dont interact with the graphical subsystem (use with -l)") +) + +var _ int = parse() + +func parse() int { + flag.Parse() + return 0 +} diff --git a/main.go b/main.go index 36a41a5..841cf7c 100644 --- a/main.go +++ b/main.go @@ -1,12 +1,10 @@ package main // import "github.com/as/a" import ( - "flag" "fmt" "image" "log" "os" - "runtime" "github.com/as/shiny/screen" mus "github.com/as/text/mouse" @@ -33,25 +31,6 @@ var ( focused = false ) -func defaultFaceSize() int { - switch runtime.GOOS { - case "darwin": - return 13 - default: - return 11 - } -} - -var ( - utf8 = flag.Bool("u", false, "enable utf8 experiment") - elastic = flag.Bool("elastic", false, "enable elastic tabstops") - oled = flag.Bool("b", false, "OLED display mode (black)") - ftsize = flag.Int("ftsize", defaultFaceSize(), "font size") - srvaddr = flag.String("l", "", "(dangerous) announce and serve file system clients on given endpoint") - clientaddr = flag.String("d", "", "dial to a remote file system on endpoint") - quiet = flag.Bool("q", false, "dont interact with the graphical subsystem (use with -l)") -) - func init() { // this grants the capability to shut down the program // it happens exactly once @@ -60,8 +39,6 @@ func init() { // error.go:/logFunc/ log.SetFlags(log.Llongfile) log.SetPrefix("a: ") - - flag.Parse() } func banner() {