Skip to content

Commit

Permalink
Merge pull request #1 from reugn/develop
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
reugn authored Aug 25, 2021
2 parents c5ae66e + 1d137b9 commit cc2ccec
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
17 changes: 17 additions & 0 deletions .github/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- '*'
- 'v*'

jobs:
goreleaser:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
16 changes: 3 additions & 13 deletions cmd/wifiqr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ 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.")

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.")
Expand All @@ -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)
Expand Down Expand Up @@ -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):")
Expand Down

0 comments on commit cc2ccec

Please sign in to comment.