Skip to content

Commit

Permalink
Merge pull request #13 from Arkaeriit/chainable_arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
quackduck committed Dec 24, 2022
2 parents b688401 + 41076af commit 3b5c884
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rem.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ func main() {
updateAndIgnoreIfHasOption("recursive", "r", nil)
updateAndIgnoreIfHasOption("", "R", nil)
updateAndIgnoreIfHasOption("one-file-system", "", nil)
updateAndIgnoreIfHasOption("-no-preserve-root", "preserve-root", nil) // short one actually used as a long option using a - at the start
updateAndIgnoreIfHasOption("preserve-root", "", nil)
updateAndIgnoreIfHasOption("no-preserve-root", "", nil)
} else {
if hasOption, _ := argsHaveOption("help", "h"); hasOption {
fmt.Println(helpMsg)
Expand Down Expand Up @@ -495,7 +496,7 @@ func argsHaveOption(long string, short string) (hasOption bool, foundAt int) {
if arg == "--" {
return false, 0
}
if arg == "--"+long && long != "" || arg == "-"+short && short != "" {
if long != "" && arg == "--"+long || (short != "" && len(arg) > 1 && arg[0] == '-' && arg[1] != '-' && strings.Contains(arg[1:], short)) {
return true, i
}
}
Expand Down

0 comments on commit 3b5c884

Please sign in to comment.