diff --git a/.github/.goreleaser.yml b/.github/.goreleaser.yml new file mode 100644 index 0000000..a8d9cf2 --- /dev/null +++ b/.github/.goreleaser.yml @@ -0,0 +1,17 @@ +project_name: wifiqr +builds: + - env: [CGO_ENABLED=0] + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 +archives: + - replacements: + darwin: macos + amd64: x86_64 + format_overrides: + - goos: windows + format: zip \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63f1b76..6898b38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - '*' + - 'v*' jobs: goreleaser: @@ -17,7 +17,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.15.x + go-version: 1.16.x - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cfd9c63..7e96d37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [1.14.x, 1.15.x] + go-version: [1.15.x, 1.16.x] steps: - name: Setup Go uses: actions/setup-go@v2 diff --git a/README.md b/README.md index edf0f23..8a3909e 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ Create a QR code with your Wi-Fi login details. Use Google Lens or other application to scan it and connect automatically. ## Installation +Pick a binary from the [releases](https://github.com/reugn/wifiqr/releases). + +### Build from source Download and install Go https://golang.org/doc/install. Clone the repository: @@ -30,8 +33,8 @@ Usage of ./wifiqr: The wireless network encryption protocol (WEP, WPA, WPA2). (default "WPA2") -file string A png file to write the QR Code (prints to stdout if not set). - -hidden string - Hidden SSID true/false. (default "false") + -hidden + Hidden SSID. -key string A pre-shared key (PSK). You'll be prompted to enter the key if not set. -size int diff --git a/cmd/wifiqr/main.go b/cmd/wifiqr/main.go index e9be1cd..66b378e 100644 --- a/cmd/wifiqr/main.go +++ b/cmd/wifiqr/main.go @@ -5,12 +5,11 @@ import ( "fmt" "os" "path/filepath" - "strconv" "github.com/reugn/wifiqr" ) -const version = "0.1.0" +const version = "0.2.0" var ( versionParam = flag.Bool("version", false, "Show version.") @@ -18,7 +17,7 @@ var ( ssidParam = flag.String("ssid", "", "The name of the wireless network. You'll be prompted to enter the SSID if not set.") keyParam = flag.String("key", "", "A pre-shared key (PSK). You'll be prompted to enter the key if not set.") encParam = flag.String("enc", "WPA2", "The wireless network encryption protocol (WEP, WPA, WPA2).") - hiddenParam = flag.String("hidden", "false", "Hidden SSID true/false.") + hiddenParam = flag.Bool("hidden", false, "Hidden SSID.") fileNameParam = flag.String("file", "", "A png file to write the QR Code (prints to stdout if not set).") sizeParam = flag.Int("size", 256, "Size is both the image width and height in pixels.") @@ -34,7 +33,7 @@ func main() { validateArguments() - config := wifiqr.NewConfig(*ssidParam, *keyParam, *encParam, validateAndGetHidden()) + config := wifiqr.NewConfig(*ssidParam, *keyParam, *encParam, *hiddenParam) q, err := wifiqr.InitCode(config) if err != nil { fmt.Println(err) @@ -62,15 +61,6 @@ func validateAndGetFileName() string { return *fileNameParam } -func validateAndGetHidden() bool { - hidden, err := strconv.ParseBool(*hiddenParam) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - return hidden -} - func validateArguments() { if *ssidParam == "" { fmt.Println("Enter the name of the wireless network (SSID):")