Fix test_fish_sudo_parser: fix fish sudo function bugs

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/d743ec32-6ae8-41c8-b7bb-6efc63f7d346

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-05 04:25:37 +00:00 committed by GitHub
parent fd7e43ab0c
commit 06b2ccb88c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -154,27 +154,26 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
if string match -r -q -- '^--$' "$arg"
break # end of options
end
if string match -r -q -- '^-[^-]*e' "$arg" or string match -q -- "--edit" "$arg"
if string match -r -q -- '^-[^-]*e' "$arg"; or string match -q -- "--edit" "$arg"
set cannot_set_env_var "y" # sudo -e
break
end
if string match -r -q -- '^-[^-]*v' "$arg" or string match -q -- "--validate" "$arg"
if string match -r -q -- '^-[^-]*v' "$arg"; or string match -q -- "--validate" "$arg"
set cannot_set_env_var "y" # sudo-rs -e
break
end
if string match -r -q -- '--user|--group|--host|--chdir|--chroot|--role|--type|--command-timeout|--auth-type|--login-class|--prompt|--close-from|--other-user' "$arg"
set ignore_arg="y"
if string match -r -q -- '^(--user|--group|--host|--chdir|--chroot|--role|--type|--command-timeout|--auth-type|--login-class|--prompt|--close-from|--other-user)$' "$arg"
set ignore_arg "y"
continue
end
if string match -r -q -- '--.+' "$arg"
continue
end
if string match -r -q -- '-.*a|-.*C|-.*c|-.*D|-.*g|-.*h|-.*p|-.*R|-.*r|-.*t|-.*T|-.*u)' "$arg"
set ignore_arg="y"
if string match -r -q -- '^-.*a|^-.*C|^-.*c|^-.*D|^-.*g|^-.*h|^-.*p|^-.*R|^-.*r|^-.*t|^-.*T|^-.*u' "$arg"
set ignore_arg "y"
continue
end
if string match -r -q -- '-.+' "$arg" or string match -r -q -- '.+=.+' "$arg"
if string match -r -q -- '-.+' "$arg"; or string match -r -q -- '.+=.+' "$arg"
continue
end
break # command found