mirror of
https://github.com/mintty/wsltty.git
synced 2025-04-16 07:40:31 +01:00
revise command-line launch scripts, support arguments (#365)
This commit is contained in:
parent
36c134820b
commit
68e11e5775
@ -155,17 +155,40 @@ regtool () {
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkbat () {
|
||||||
if $config
|
echo Creating "$1.bat"
|
||||||
then while read line; do echo "$line"; done <</EOB > mkbat.bat
|
while read line; do echo "$line"; done <<-\/EOB > "$1".bat
|
||||||
@echo off
|
@echo off
|
||||||
echo Creating %1.bat
|
rem Start mintty terminal for WSL
|
||||||
|
|
||||||
echo @echo off> %1.bat
|
rem get basename of this script file,
|
||||||
echo rem Start mintty terminal for WSL package %name% in current directory>> %1.bat
|
rem use it to select WSL distribution and homedir flag
|
||||||
echo %target% -i "%icon%" %minttyargs% %bridgeargs% %%*>> %1.bat
|
set dist=%~n0
|
||||||
/EOB
|
|
||||||
fi
|
rem start in current directory
|
||||||
|
set cdir=
|
||||||
|
rem if script name ends with ~, extract WSL distribution and param -~
|
||||||
|
if "%dist:~-1%" == "~" set cdir=-~ && set dist=%dist:~0,-1%
|
||||||
|
rem map WSL default distribution
|
||||||
|
if "%dist%" == "WSL" set dist=
|
||||||
|
|
||||||
|
rem check if we have an explicit -d DIST parameter
|
||||||
|
if "%1" == "-d" set dist=%2 && shift && shift
|
||||||
|
|
||||||
|
chcp 65001 > nul:
|
||||||
|
|
||||||
|
if "%1" == "" goto login
|
||||||
|
|
||||||
|
:cmd
|
||||||
|
"%LOCALAPPDATA%/wsltty/bin/mintty.exe" -i "%LOCALAPPDATA%/wsltty/wsl.ico" --WSL="%dist%" --configdir="%APPDATA%/wsltty" %cdir% %*
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:login
|
||||||
|
"%LOCALAPPDATA%/wsltty/bin/mintty.exe" -i "%LOCALAPPDATA%/wsltty/wsl.ico" --WSL="%dist%" --configdir="%APPDATA%/wsltty" %cdir% -
|
||||||
|
|
||||||
|
:end
|
||||||
|
/EOB
|
||||||
|
}
|
||||||
|
|
||||||
if $custominst && $config && ! $remove
|
if $custominst && $config && ! $remove
|
||||||
then
|
then
|
||||||
@ -366,7 +389,8 @@ config () {
|
|||||||
copy "$name Terminal %.lnk" "$APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty"
|
copy "$name Terminal %.lnk" "$APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty"
|
||||||
|
|
||||||
# launch script in . -> WSLtty home, WindowsApps launch folder
|
# launch script in . -> WSLtty home, WindowsApps launch folder
|
||||||
cmd /C mkbat.bat "$name"
|
#cmd /C mkbat.bat "$name"
|
||||||
|
mkbat "$name"
|
||||||
copy "$name.bat" "$LOCALAPPDATA\\Microsoft\\WindowsApps"
|
copy "$name.bat" "$LOCALAPPDATA\\Microsoft\\WindowsApps"
|
||||||
|
|
||||||
# store backup copies in installation dir
|
# store backup copies in installation dir
|
||||||
@ -402,7 +426,8 @@ config () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# launch script in ~ -> WSLtty home, WindowsApps launch folder
|
# launch script in ~ -> WSLtty home, WindowsApps launch folder
|
||||||
cmd /C mkbat.bat "$name~"
|
#cmd /C mkbat.bat "$name~"
|
||||||
|
mkbat "$name~"
|
||||||
copy "$name~.bat" "$LOCALAPPDATA\\Microsoft\\WindowsApps"
|
copy "$name~.bat" "$LOCALAPPDATA\\Microsoft\\WindowsApps"
|
||||||
|
|
||||||
# store backup copies in installation dir
|
# store backup copies in installation dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user