Skip to content
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

use alias for command #157678

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,14 @@ __vsc_precmd() {

__vsc_preexec() {
__vsc_initialized=1
if [[ ! "$BASH_COMMAND" =~ ^__vsc_prompt* ]]; then
__vsc_current_command=$BASH_COMMAND
if [[ -z $BASH_COMMAND ]]; then
__vsc_command= "$(which $BASH_COMMAND)"
__vsc_command= basename __vsc_command
Comment on lines +109 to +110
Copy link
Member

Choose a reason for hiding this comment

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

BASH_COMMAND should have the full command line so we wouldn't be able to run basename on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah currently working on a different idea
"The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias. " so maybe we can quote it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already tried unsetting the expand alias option at the top of the file and setting it at the bottom, but that didn't work - maybe permissions? does work when I manually unset that in the terminal though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but also "Aliases are expanded when a command is read, not when it is executed." so idk if that's even possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is doable atm without storing all aliases and checking each (slow) since the moment the command is read, it's expanded

else
__vsc_command=""
fi
if [[ ! "$__vsc_command" =~ ^__vsc_prompt* ]]; then
__vsc_current_command=__vsc_command
else
__vsc_current_command=""
fi
Expand Down