Skip to content

Commit 66cc8dd

Browse files
committed
alias which does not contains command or variables
1 parent 33a4feb commit 66cc8dd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bash_profile.ps1
2-
*.ignore
2+
*.ignore
3+
*.ignore.mjs
4+
launch.json

bash2pwsh.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ function convert(bash) {
5656
// $d_diary='C:/Dev'
5757
bash = bash.replace(/export (\w+)=(['"].*?['"])/g, "$$$1=$2");
5858

59-
// alias which does not contains variables
59+
// alias which does not contains command or variables
6060
// alias code='C:/Dev/VSCode/Code.exe'
6161
// >>>
6262
// Set-Alias -Name code -Value 'cd $d_diary'
6363
bash = bash.replace(
64-
/alias (\w+)=(['"][^$$]+?['"])/g,
64+
/alias (\w+)=(['"](?!\w{1,4} )[^$$]+?['"])/g,
6565
"Set-Alias -Name $1 -Value $2"
6666
);
6767

68-
// ## alias which contains variables
68+
// ## alias which contains command or variables
6969
// alias cd_diary="cd $d_diary"
7070
// >>>
7171
// function cd_diary() { cd $d_diary }

0 commit comments

Comments
 (0)