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

multi parameter support when creating new aliases #1750

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions bin/alias.bat
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ for /f "delims== tokens=1,2 usebackq" %%G in (`echo "%_x%"`) do (
set alias_value=%%H
)

:: create with multiple parameters
if [%1] == [] and [%2] == [] (
set _x=%1=%2
:: if command create was submitted
if [%1] == "create" and [%3] (
set _x=%2=%3
)
for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do (
set alias_name=%%G
set alias_value=%%H
)
)

:: leading quotes added while validating
set alias_name=%alias_name:~1%

Expand Down Expand Up @@ -114,12 +127,14 @@ echo.
echo. alias [options] [alias=full command]
echo.
echo.Options:
echo.
echo. /d [alias] Delete an [alias].
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo. Default: %cmder_root%\config\user-aliases.cmd
echo. /reload Reload the aliases file. Can be used with /f argument.
echo. Default: %cmder_root%\config\user-aliases.cmd
echo.
echo. [alias=command] Create an [alias].
echo. Multiple parameter syntax: create [alias] [full command]
echo. /d [alias] Delete an [alias].
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo. Default: %cmder_root%\config\user-aliases.cmd
echo. /reload Reload the aliases file. Can be used with /f argument.
echo. Default: %cmder_root%\config\user-aliases.cmd
echo.
echo. If alias is called with no parameters, it will display the list of existing aliases.
echo.
Expand Down