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

Import aliases #2

Closed
krlmlr opened this issue Nov 25, 2018 · 10 comments
Closed

Import aliases #2

krlmlr opened this issue Nov 25, 2018 · 10 comments

Comments

@krlmlr
Copy link
Contributor

krlmlr commented Nov 25, 2018

I have defined quite a few aliases which I'd like to have available as top-level commands in a Git shell. git-sh had this, would you support this here too?

@krlmlr
Copy link
Contributor Author

krlmlr commented Nov 25, 2018

I like the approach of shgit as a much lighter-weight tool that focuses on the main task: the prompt and providing top-level commands. We don't need a Makefile, we don't need opinionated aliases, and it's great to optimize for syscalls for better Windows support. Having my own aliases available is still important to me, though.

@roeme
Copy link
Owner

roeme commented Nov 25, 2018

Yup, this will be supported, in fact, already is. It seems that I didn't push the corresponding commits here to github. Doing this in a minute.

@roeme
Copy link
Owner

roeme commented Nov 25, 2018

As of 2e51aff, should work now.

@krlmlr
Copy link
Contributor Author

krlmlr commented Nov 25, 2018

Thanks. I'm now seeing:

...
Reading color escapes from git...
bash: ./shgit.sh: line 122: syntax error near unexpected token `git'
bash: ./shgit.sh: line 122: `git diff --ours '

Could my do alias be a problem?

@krlmlr
Copy link
Contributor Author

krlmlr commented Nov 25, 2018

After removing that for loop, aliases work for me, but the color in the prompt is gone. Leaving the issue open for now.

@krlmlr
Copy link
Contributor Author

krlmlr commented Nov 25, 2018

I see now, the shell mistakes the do as an alias. Maybe use \do ? (OTOH, it's probably not too bright to alias a shell keyword...)

@roeme
Copy link
Owner

roeme commented Nov 25, 2018

Yeah, this is a bit of a conundrum: I don't want to constrain the user in what kind of aliases can be used, but at the same time, as you correctly pointed out, this clashes a bit with the shell in general. Maybe there's an elegant way out of this. Thinking.

@krlmlr
Copy link
Contributor Author

krlmlr commented Nov 25, 2018

I think we can avoid setting aliases that are one of ! case coproc do done elif else esac fi for function if in select then until while { } time [[ ]], with a warning. The alias is still available with e.g. git do, but not as a top-level alias.

(Also, a "quiet" where initialization info isn't shown would be great.)

@roeme
Copy link
Owner

roeme commented Nov 25, 2018

That is a good idea, and tentatively implemented with 308c7ed

@krlmlr
Copy link
Contributor Author

krlmlr commented Nov 25, 2018

Thanks for looking into it!

@krlmlr krlmlr closed this as completed Nov 25, 2018
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