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

Bug in alias.bat #52

Closed
donpark2000 opened this issue Nov 28, 2013 · 7 comments
Closed

Bug in alias.bat #52

donpark2000 opened this issue Nov 28, 2013 · 7 comments

Comments

@donpark2000
Copy link

If you type "alias" with no arguments it screws up your aliases file. Adding the following two lines to the top of the alias.bat file gives better behavior:
@echo off
if "%~1" == "" (doskey /macros:all & goto :EOF )

@samvasko
Copy link
Contributor

Interesting @Vivix, I summon you! ⚡
I will test that right now

@samvasko
Copy link
Contributor

This does not seem to be an issue for me. Can you replicate that?
screenshot 2013-11-28 20 24 14

@donpark2000
Copy link
Author

Here is the original content of the alias.bat file from my download.

echo %* >> %~dp0..\config\aliases
doskey /macrofile=%~dp0..\config\aliases
echo Alias created

Here is the original content of the alias file in config:

e.=explorer .
gl=git log --oneline --all --graph --decorate $*
ls=ls --color $*

If I type "alias" with no arguments in a cmder window it tells me "Alias created". The contents of my alias file now look like this:

e.=explorer .
gl=git log --oneline --all --graph --decorate $*
ls=ls --color $*
ECHO is on.

And the next time you run alias.bat you get an error from the "ECHO is on" line "Invalid macro definition"

Following my suggestion and changing the alias.bat script so it looks like this solves the problem, and when you type "alias" with no arguments you get a list of your aliases - better emulation of bash.

@echo off
if "%~1" == "" (doskey /macros:all & goto :EOF )
echo %* >> %~dp0..\config\aliases
doskey /macrofile=%~dp0..\config\aliases
echo Alias created

@donpark2000
Copy link
Author

I thought I was closing the comment ... no the issue. It is still an issue - I closed it accidently

@Vivix
Copy link
Contributor

Vivix commented Nov 29, 2013

Hey! Alias.bat has changed, it is no longer the three lines presented here, and has adopted a minimal validation against empty arguments or malformed alias names. Though making no arguments print your aliases is probably a good idea for people used to bash. Could you update/pull the latest changes and see if it fixes things?

@samvasko
Copy link
Contributor

My fault, sorry. I am working on 1.1 that will contain the fix. I should have asked about the version.

@samvasko
Copy link
Contributor

Should be fixed in latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants