Skip to content

Treat sudo sudoedit as sudoedit with warning #1205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2025

Conversation

bjorn3
Copy link
Collaborator

@bjorn3 bjorn3 commented Jul 21, 2025

@bjorn3 bjorn3 requested a review from squell July 21, 2025 11:43
@bjorn3 bjorn3 force-pushed the sudo_sudoedit branch 3 times, most recently from 77ed53e to 2b660ee Compare July 21, 2025 11:59
@squell squell added this to the Sudoedit milestone Jul 21, 2025
Copy link
Member

@squell squell left a comment

Choose a reason for hiding this comment

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

With the suggestion, I think this is straightforward acceptable, but I think an even more neat solution would be to perform this check in the front-end in cli/mod.rs, since then SudoOptions is still undifferentiated.

Simply put: when the positional_args are set in place (line 735 in cli/mod.rs), check if the command being requested is sudoedit according to is_sudoedit, and if so enable the edit flag + emit the warning at that point. That feels slightly simpler.

@squell
Copy link
Member

squell commented Jul 22, 2025

Note that of course it's remarkable that the CLI takes the time to parse options into a single SudoOptions, takes the time to split them out into separate option objects, and then combines the information again into the Context object. But that is a story for another time...

@bjorn3 bjorn3 enabled auto-merge July 22, 2025 10:23
@bjorn3 bjorn3 merged commit d7b5087 into trifectatechfoundation:main Jul 22, 2025
17 checks passed
@bjorn3 bjorn3 deleted the sudo_sudoedit branch July 22, 2025 11:09
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.

Behavior for sudo sudoedit
2 participants