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

Alias with $* does not get correctly converted #91

Open
bentitmus opened this issue Nov 3, 2020 · 1 comment
Open

Alias with $* does not get correctly converted #91

bentitmus opened this issue Nov 3, 2020 · 1 comment

Comments

@bentitmus
Copy link

For aliases with $* in them, bash will accept the alias. fish complains because these aren't valid in fish. bass should convert these to an acceptable form for fish. Test case:

test.sh:
alias testing='ls $*' -l
$ source test.sh
$ testing .. <Ctrl-Alt-e>
$ ls  -l ..
> bass -d source test.sh
alias "testing"='ls $* -l'- (line 1): $* is not supported. In fish, please use $argv.
function testing --wraps 'ls $* -l' --description 'alias testing=ls $* -l';  ls $* -l $argv; end
...

I believe bash is just silently dropping the $*, although I don't have a lot of experience of bash.

Unfortunately this is in some scripts that I can't change, otherwise I'd just alter the original bash script.

@wrzian
Copy link

wrzian commented May 28, 2024

I was able to fix this with a simple change in the main python file to replace $* with $argv in the copied alias commands, although I assume this is fragile, so do so at your own risk.

You can add this line:

        v = v.replace("$*", "$argv")

to the __bass.py file just before the line with alias_lines.append("alias " + ... (118 for me)

If you installed with oh-my-fish, it should be at ~/.local/share/omf/pkg/bass/functions/__bass.py

ATing the maintainer: @edc, not sure if you would want to merge this change or not, maybe behind a flag. I'll leave that to you.

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

No branches or pull requests

2 participants