Skip to content

Commit

Permalink
Incorporate better moreThanOne function
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed May 16, 2016
1 parent 4993689 commit 94f1922
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions core/commands/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,17 @@ Type: <type>`),
Type: Object{},
}

func moreThanOne(a, b, c bool) bool {
return a && b || b && c || a && c
}

func statGetFormatOptions(req cmds.Request) (string, error) {

hash, _, _ := req.Option("hash").Bool()
size, _, _ := req.Option("size").Bool()
formatSpecified := req.Option("format").Found()

count := 0
if hash {
count++
}
if size {
count++
}
if formatSpecified {
count++
}
if count > 1 {
if moreThanOne(hash, size, formatSpecified) {
return "", formatError
}

Expand Down

0 comments on commit 94f1922

Please sign in to comment.