mirror of
https://github.com/Jguer/yay
synced 2024-09-06 16:43:03 +00:00
Hanlde double args of mixed short and long types
99% of the time if a user wants to pas an argument twice they would do `-cc` or `--clean --clean`. Still doing `-c --clean` is still a valid thing to do. This commits allows getArg() to this properly.
This commit is contained in:
parent
dccfcb6c69
commit
ef5fda0264
22
parser.go
22
parser.go
|
@ -217,22 +217,36 @@ func (parser *arguments) existsArg(options ...string) bool {
|
|||
}
|
||||
|
||||
func (parser *arguments) getArg(options ...string) (arg string, double bool, exists bool) {
|
||||
existCount := 0
|
||||
|
||||
for _, option := range options {
|
||||
arg, exists = parser.options[option]
|
||||
|
||||
if exists {
|
||||
_, double = parser.doubles[option]
|
||||
return
|
||||
existCount++
|
||||
_, exists = parser.doubles[option]
|
||||
|
||||
if exists {
|
||||
existCount++
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
arg, exists = parser.globals[option]
|
||||
|
||||
if exists {
|
||||
_, double = parser.doubles[option]
|
||||
return
|
||||
existCount++
|
||||
_, exists = parser.doubles[option]
|
||||
|
||||
if exists {
|
||||
existCount++
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
double = existCount >= 2
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue