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

Make aliases dynamic #7

Open
danyisill opened this issue Mar 19, 2020 · 1 comment
Open

Make aliases dynamic #7

danyisill opened this issue Mar 19, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@danyisill
Copy link
Collaborator

Expected:

[18:34] Install OpenBSD: based.
[18:34] ms skinee's boy toy: .alias mockb mock !!^
[18:34] BOT Simp'O'Matic: Alias added:
.mockb now maps to .mock !!^.
[18:34] ms skinee's boy toy: .mockb
[18:34] BOT Simp'O'Matic: .mOcKb NoW mApS tO .mOcK !!^.

Got:

[18:34] Install OpenBSD: based.
[18:34] ms skinee's boy toy: .alias mockb mock !!^
[18:34] BOT Simp'O'Matic: Alias added:
.mockb now maps to .mock based.
@danyisill danyisill added the enhancement New feature or request label Mar 19, 2020
@Demonstrandum
Copy link
Collaborator

!! is part of the command preprocessing, and just text-replaces right before the command is execute, just like in POSIX shells.

It is still useful to have it not be dynamic, so I think I'll add a dynamic version, say $!! along with $reply. Of course, the dynamic expansions will only be meaningful to use in the context of aliases and functions (when we eventually get around to adding that). Otherwise, $!! should act exactly like !!.

The way it should be implemented is that first, we identify that it is a command, if so, we expand history (excluding $...). Then we do alias expansion. Once that's done, the final stage is to expand the dynamic variables, i.e. $1, $2, $reply, $!!, etc.

Anyone feel like assigning themselves this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants