@@ -5,20 +5,19 @@ import (
55 "fmt"
66 "os"
77 "path/filepath"
8- "strconv"
98
109 "github.com/reugn/wifiqr"
1110)
1211
13- const version = "0.1 .0"
12+ const version = "0.2 .0"
1413
1514var (
1615 versionParam = flag .Bool ("version" , false , "Show version." )
1716
1817 ssidParam = flag .String ("ssid" , "" , "The name of the wireless network. You'll be prompted to enter the SSID if not set." )
1918 keyParam = flag .String ("key" , "" , "A pre-shared key (PSK). You'll be prompted to enter the key if not set." )
2019 encParam = flag .String ("enc" , "WPA2" , "The wireless network encryption protocol (WEP, WPA, WPA2)." )
21- hiddenParam = flag .String ("hidden" , " false" , "Hidden SSID true/false ." )
20+ hiddenParam = flag .Bool ("hidden" , false , "Hidden SSID." )
2221
2322 fileNameParam = flag .String ("file" , "" , "A png file to write the QR Code (prints to stdout if not set)." )
2423 sizeParam = flag .Int ("size" , 256 , "Size is both the image width and height in pixels." )
@@ -34,7 +33,7 @@ func main() {
3433
3534 validateArguments ()
3635
37- config := wifiqr .NewConfig (* ssidParam , * keyParam , * encParam , validateAndGetHidden () )
36+ config := wifiqr .NewConfig (* ssidParam , * keyParam , * encParam , * hiddenParam )
3837 q , err := wifiqr .InitCode (config )
3938 if err != nil {
4039 fmt .Println (err )
@@ -62,15 +61,6 @@ func validateAndGetFileName() string {
6261 return * fileNameParam
6362}
6463
65- func validateAndGetHidden () bool {
66- hidden , err := strconv .ParseBool (* hiddenParam )
67- if err != nil {
68- fmt .Println (err )
69- os .Exit (1 )
70- }
71- return hidden
72- }
73-
7464func validateArguments () {
7565 if * ssidParam == "" {
7666 fmt .Println ("Enter the name of the wireless network (SSID):" )
0 commit comments