-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
Alias that returns modified command #5473
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
# Conflicts: # tests/procs/test_specs.py # xonsh/procs/specs.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This comment was marked as off-topic.
This comment was marked as off-topic.
Hey @bennyyip! I moved your comment to the sudo thread with proposal to make a xontrib. Thank you for sharing this! |
# Conflicts: # tests/test_integrations.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I've changed api to more clear and putted CUT_ARGS to aliases to avoid remembering by jnoortheen ;) |
@gforsyth here is the new issue where in fact people want to use commands without wrapping it into the callable alias to avoid capturing/tty issues - #5512 (comment) but now they need to wrap it into the callable alias and facing with questions about managing the TTY. |
Motivation
After deep dive into How make sudo expand aliases? I understood that we want to modify command before execution but we can't achieve this because all we can is to use callable alias to wrap the command into it. But callable alias is a complex "process wrapper" and using it with subprocess operators has requirements on managing threading, capturing and std manually. Implementing this is high bar for inexperienced users who just want to play with command itself.
Thus we need the way between simple string aliases and callable aliases. I implemented this way as "Alias that returns modified command".
Before
No way to create alias that returns modified command before execution.
After
Tag
CUT_ARGS
is additional tag to have an ability to rid from the tail of arguments. It's needed sometimes in other aliases too (#5452).Closes #2618 #2893
Notes
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 comment