Skip to content

Commit

Permalink
Merge pull request #31 from mcktr/bugfix/password-required
Browse files Browse the repository at this point in the history
Make password optional
  • Loading branch information
mcktr authored Feb 27, 2019
2 parents 4886a19 + 6ddd624 commit 324206e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions cmd/check_fritz/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,22 @@ func getVersion() string {
return "check_fritz version " + version
}

func checkRequiredFlags(hostname string, port string, username string, password string) bool {
if hostname == "" {
func checkRequiredFlags(aI *ArgumentInformation) bool {
if aI.Hostname == nil || *aI.Hostname == "" {
fmt.Println("No hostname")
return false
}

if port == "" {
if aI.Port == nil || *aI.Port == "" {
fmt.Println("No port")
return false
}

if username == "" {
if aI.Username == nil || *aI.Username == "" {
fmt.Println("No username")
return false
}

if password == "" {
fmt.Println("No password")
return false
}

return true
}

Expand Down Expand Up @@ -153,7 +148,7 @@ func main() {
aI.createIndex(cmdline.OptionValue("index"))
}

if !checkRequiredFlags(*aI.Hostname, *aI.Port, *aI.Username, *aI.Password) {
if !checkRequiredFlags(&aI) {
os.Exit(exitUnknown)
}

Expand Down

0 comments on commit 324206e

Please sign in to comment.