Skip to content

feat(sudo): option arg (non-)completion improvements#1683

Merged
scop merged 3 commits into
mainfrom
feat/sudo-opt-args
Jul 9, 2026
Merged

feat(sudo): option arg (non-)completion improvements#1683
scop merged 3 commits into
mainfrom
feat/sudo-opt-args

Conversation

@scop

@scop scop commented Jul 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

@akinomyoga akinomyoga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-approving with the following points.

Comment thread completions-core/sudo.bash Outdated
fi
# shellcheck disable=SC2254
[[ ${words[i]} == @(--@(close-from|chdir|group|host|prompt|chroot|role|command-timeout|type|other-user|user)|-${noargopts}[CDghpRrTtUu]) ]] &&
[[ ${words[i]} == @(--@(close-from|chdir|group|host|prompt|chroot|role|command-timeout|type|other-user|user|preserve-env)|-${noargopts}[CDghpRrTtUu]) ]] &&

@akinomyoga akinomyoga Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ordering of the list of the long option names is roughly based on the ordering in the man page. Then, I think preserve-env should be inserted after chdir (based on the man page in sudo-1.9.15p5). For the same reason, I think command-timeout should be moved after other-user (or after type if one bases on sudo --help instead of the man page). Another option is to sort them in lexicographical order.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not compared the two, but the ordering seemed to be roughly that of the --help output, and --preserve-end is at the end with sudo-rs so it ended up there.

Reordered all of them in 80156e3, merging with that.

Comment thread completions-core/sudo.bash Outdated
Comment on lines +40 to +41
--close-from | --help | --prompt | --role | --type | \
--command-timeout | --preserve-env | --version | \

@akinomyoga akinomyoga Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, --preserve-env should be inserted after --close-from.

@scop scop merged commit 605370d into main Jul 9, 2026
12 checks passed
@scop scop deleted the feat/sudo-opt-args branch July 9, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants