Skip to content

Commit

Permalink
Merge pull request #2449 from daxgames/alias_fix
Browse files Browse the repository at this point in the history
Alias fix
  • Loading branch information
daxgames committed Dec 23, 2020
2 parents e0b8ebc + ae0b772 commit 9c9eac1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Change Log

## [Unreleased]
## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23)

### Fixes

- [bug] Running `alias ..=cd ..` removes other aliases #2394
- Switch to @chrisant996 [Clink](https://github.com/chrisant996/clink/) v1.1.10 to fix Clink newer Windows 10 releases.
- Fix `\Git\cmd\git.exe found. was unexpected at this time.`
- Documentation fixes.
Expand Down
11 changes: 9 additions & 2 deletions vendor/bin/alias.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ set alias_name=!alias_name:~1!
:: trailing quotes added while validating
set alias_value=!alias_value:~0,-1!

:: '.' escaped
set alias_name_esc=!alias_name:.=\.!

::remove spaces
set _temp=%alias_name: =%

Expand All @@ -91,15 +94,19 @@ if not ["%_temp%"] == ["%alias_name%"] (
)

:: replace already defined alias
%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
%WINDIR%\System32\findstr /v /i "^%alias_name_esc%=" "%ALIASES%" >> "%ALIASES%.tmp"
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
doskey /macrofile="%ALIASES%"
endlocal
exit /b

:p_del
set del_alias=%~1
%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"

:: '.' escaped
set del_alias_esc=!del_alias:.=\.!

%WINDIR%\System32\findstr /v /i "^%del_alias_esc%=" "%ALIASES%" >> "%ALIASES%.tmp"
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
doskey %del_alias%=
doskey /macrofile="%ALIASES%"
Expand Down

0 comments on commit 9c9eac1

Please sign in to comment.