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

Enhanced alias.bat to allow file storage path #862

Merged
merged 3 commits into from
Mar 21, 2016

Conversation

daxgames
Copy link
Member

@daxgames daxgames commented Mar 2, 2016

This PR changes/enhances bin/alias.bat:

  1. bin/alias.bat now has more robust command line parsing.

  2. bin/alias.bat now uses config/user-aliases.cmd as the default alias store, this is to make things consistent across all shells.

  3. config/user-aliases.cmd is a self executing batch file/doskey macro store.

    ;= @echo off
    ;= rem Call DOSKEY and use this file as the macrofile
    ;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
    ;= rem In batch mode, jump to the end of the file
    ;= goto:eof
    ;= Add aliases below here
    e.=explorer .
    gl=git log --oneline --all --graph --decorate  $*
    ls=ls --show-control-chars -F --color $*
    pwd=cd
    clear=cls
    history=cat %CMDER_ROOT%\config\.history
    unalias=alias /d $1
    vi=vim $*
    
  4. vendor/init.bat will update existing config/aliases to the new self executing config/user-aliases.cmd format and remove the old file.

  5. bin/alias.bat has a new command line argument '/f' that allows specification of the file store for new aliases.

  6. bin/alias.bat now displays 'ALL' loaded macros if executed with no arguments.

  7. bin/alias.bat deletes aliases from memory and the file store when '/d' is specified.

@daxgames
Copy link
Member Author

daxgames commented Mar 2, 2016

I just wanted to explain the use case for this PR to justify its inclusion in core CMder.

I use Cmder with a team of people as a shared work env. We actually have a shared config in a git repo that we overlay on top of a binary Cmder distro so all team members can contribute to the shared config bits via source control. This PR is how we are able to manage the shared aliases while allowing users to have user personal aliases. We create '%cmder_root%\config\profile.d\shared-aliases.cmd' and '%cmder_root%\config\profile.d\user-aliases.cmd', they execute in that order so the user has final say and can override any shared alias.

@MartiUK
Copy link
Member

MartiUK commented Mar 17, 2016

Could you resync your branch, thanks.

@daxgames
Copy link
Member Author

Done. Sorry for the delay.

MartiUK added a commit that referenced this pull request Mar 21, 2016
Enhanced alias.bat to allow file storage path
@MartiUK MartiUK merged commit d5a1ce6 into cmderdev:development Mar 21, 2016
@daxgames daxgames deleted the better_aliases branch March 21, 2016 19:17
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

Successfully merging this pull request may close these issues.

2 participants