mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
add diag helper scripts and adds to the path (#1918)
These scripts are to help us help our users by getting a relative picture of their environment that they can submit with an incident.
This commit is contained in:
parent
c5a6afbf5b
commit
3a11d45552
41
vendor/bin/cmder_diag.cmd
vendored
Normal file
41
vendor/bin/cmder_diag.cmd
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
echo ------------------------------------
|
||||||
|
echo dir "%cmder_root%"
|
||||||
|
echo ------------------------------------
|
||||||
|
dir "%cmder_root%"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ------------------------------------
|
||||||
|
echo dir "%cmder_root%\vendor"
|
||||||
|
echo ------------------------------------
|
||||||
|
dir "%cmder_root%\vendor"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ------------------------------------
|
||||||
|
echo dir /s "%cmder_root%\bin"
|
||||||
|
echo ------------------------------------
|
||||||
|
dir /s "%cmder_root%\bin"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ------------------------------------
|
||||||
|
echo dir /s "%cmder_root%\config"
|
||||||
|
echo ------------------------------------
|
||||||
|
dir /s "%cmder_root%\config"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ------------------------------------
|
||||||
|
echo set
|
||||||
|
echo ------------------------------------
|
||||||
|
set
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ------------------------------------
|
||||||
|
echo where git
|
||||||
|
echo ------------------------------------
|
||||||
|
where git
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ------------------------------------
|
||||||
|
echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team!
|
||||||
|
echo ------------------------------------
|
39
vendor/bin/cmder_diag.ps1
vendored
Normal file
39
vendor/bin/cmder_diag.ps1
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
write-host ------------------------------------
|
||||||
|
write-host get-childitem "$env:CMDER_ROOT"
|
||||||
|
write-host ------------------------------------
|
||||||
|
get-childitem "$env:CMDER_ROOT"
|
||||||
|
|
||||||
|
write-host ''
|
||||||
|
write-host ------------------------------------
|
||||||
|
write-host get-childitem "$env:CMDER_ROOT/vendor"
|
||||||
|
write-host ------------------------------------
|
||||||
|
get-childitem "$env:CMDER_ROOT/vendor"
|
||||||
|
|
||||||
|
write-host ''
|
||||||
|
write-host ------------------------------------
|
||||||
|
write-host get-childitem -s "$env:CMDER_ROOT/bin"
|
||||||
|
write-host ------------------------------------
|
||||||
|
get-childitem -s "$env:CMDER_ROOT/bin"
|
||||||
|
|
||||||
|
write-host ''
|
||||||
|
write-host ------------------------------------
|
||||||
|
write-host get-childitem -s "$env:CMDER_ROOT/config"
|
||||||
|
write-host ------------------------------------
|
||||||
|
get-childitem -s "$env:CMDER_ROOT/config"
|
||||||
|
|
||||||
|
write-host ''
|
||||||
|
write-host ------------------------------------
|
||||||
|
write-host get-childitem env:
|
||||||
|
write-host ------------------------------------
|
||||||
|
get-childitem env: |ft -autosize -wrap
|
||||||
|
|
||||||
|
write-host ''
|
||||||
|
write-host ------------------------------------
|
||||||
|
write-host get-command git
|
||||||
|
write-host ------------------------------------
|
||||||
|
get-command git
|
||||||
|
|
||||||
|
write-host ''
|
||||||
|
write-host ------------------------------------
|
||||||
|
write-host Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team!
|
||||||
|
write-host ------------------------------------
|
39
vendor/bin/cmder_diag.sh
vendored
Normal file
39
vendor/bin/cmder_diag.sh
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
echo ------------------------------------
|
||||||
|
echo ls -la "$CMDER_ROOT"
|
||||||
|
echo ------------------------------------
|
||||||
|
ls -la "$CMDER_ROOT"
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo ------------------------------------
|
||||||
|
echo ls -la "$CMDER_ROOT/vendor"
|
||||||
|
echo ------------------------------------
|
||||||
|
ls -la "$CMDER_ROOT/vendor"
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo ------------------------------------
|
||||||
|
echo ls -la /s "$CMDER_ROOT/bin"
|
||||||
|
echo ------------------------------------
|
||||||
|
ls -laR /s "$CMDER_ROOT/bin"
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo ------------------------------------
|
||||||
|
echo ls -la /s "$CMDER_ROOT/config"
|
||||||
|
echo ------------------------------------
|
||||||
|
ls -laR /s "$CMDER_ROOT/config"
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo ------------------------------------
|
||||||
|
echo env
|
||||||
|
echo ------------------------------------
|
||||||
|
env
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo ------------------------------------
|
||||||
|
echo which git
|
||||||
|
echo ------------------------------------
|
||||||
|
which git
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo ------------------------------------
|
||||||
|
echo Make sure you sanitize this output of private data prior to posting it online for review by the CMDER Team!
|
||||||
|
echo ------------------------------------
|
22
vendor/bin/timer.cmd
vendored
Normal file
22
vendor/bin/timer.cmd
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set start=%~1
|
||||||
|
set end=%~2
|
||||||
|
|
||||||
|
set options="tokens=1-4 delims=:.,"
|
||||||
|
for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
|
||||||
|
for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100
|
||||||
|
|
||||||
|
set /a hours=%end_h%-%start_h%
|
||||||
|
set /a mins=%end_m%-%start_m%
|
||||||
|
set /a secs=%end_s%-%start_s%
|
||||||
|
set /a ms=%end_ms%-%start_ms%
|
||||||
|
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
|
||||||
|
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
|
||||||
|
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
|
||||||
|
if %hours% lss 0 set /a hours = 24%hours%
|
||||||
|
if 1%ms% lss 100 set ms=0%ms%
|
||||||
|
|
||||||
|
:: Mission accomplished
|
||||||
|
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
|
||||||
|
echo Elapsed Time: %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total)
|
4
vendor/cmder.sh
vendored
4
vendor/cmder.sh
vendored
@ -45,7 +45,7 @@ if [[ ! "$PATH" =~ "${GIT_INSTALL_ROOT}/bin:" ]] ; then
|
|||||||
PATH=${GIT_INSTALL_ROOT}/bin:$PATH
|
PATH=${GIT_INSTALL_ROOT}/bin:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT}
|
PATH=${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT}
|
||||||
|
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
@ -80,6 +80,8 @@ if [ "${CMDER_USER_CONFIG}" != "" ] ; then
|
|||||||
mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh"
|
mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export PATH=${CMDER_USER_CONFIG}/bin:$PATH
|
||||||
|
|
||||||
CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh"
|
CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh"
|
||||||
if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then
|
if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then
|
||||||
. "${CMDER_USER_CONFIG}/user_profile.sh"
|
. "${CMDER_USER_CONFIG}/user_profile.sh"
|
||||||
|
4
vendor/cmder_exinit
vendored
4
vendor/cmder_exinit
vendored
@ -63,7 +63,7 @@ if [ ! "$CMDER_ROOT" = "" ] ; then
|
|||||||
|
|
||||||
export CMDER_ROOT
|
export CMDER_ROOT
|
||||||
|
|
||||||
PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT}
|
PATH=${CMDER_ROOT}/bin:${CMDER_ROOT}/vendor/bin:$PATH:${CMDER_ROOT}
|
||||||
|
|
||||||
export PATH
|
export PATH
|
||||||
|
|
||||||
@ -98,6 +98,8 @@ if [ ! "$CMDER_ROOT" = "" ] ; then
|
|||||||
mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh"
|
mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export PATH=${CMDER_USER_CONFIG}/bin:$PATH
|
||||||
|
|
||||||
CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh"
|
CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh"
|
||||||
if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then
|
if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then
|
||||||
. "${CMDER_USER_CONFIG}/user_profile.sh"
|
. "${CMDER_USER_CONFIG}/user_profile.sh"
|
||||||
|
9
vendor/init.bat
vendored
9
vendor/init.bat
vendored
@ -1,5 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
set cmder_init_start=%time%
|
||||||
|
|
||||||
:: Init Script for cmd.exe
|
:: Init Script for cmd.exe
|
||||||
:: Created as part of cmder project
|
:: Created as part of cmder project
|
||||||
|
|
||||||
@ -38,6 +40,8 @@ call "%cmder_root%\vendor\lib\lib_profile"
|
|||||||
:var_loop
|
:var_loop
|
||||||
if "%~1" == "" (
|
if "%~1" == "" (
|
||||||
goto :start
|
goto :start
|
||||||
|
) else if /i "%1"=="/t" (
|
||||||
|
set time_init=1
|
||||||
) else if /i "%1"=="/v" (
|
) else if /i "%1"=="/v" (
|
||||||
set verbose_output=1
|
set verbose_output=1
|
||||||
) else if /i "%1"=="/d" (
|
) else if /i "%1"=="/d" (
|
||||||
@ -386,4 +390,9 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD
|
|||||||
set initialConfig=
|
set initialConfig=
|
||||||
set CMDER_CONFIGURED=1
|
set CMDER_CONFIGURED=1
|
||||||
|
|
||||||
|
set cmder_init_end=%time%
|
||||||
|
|
||||||
|
if %time_init% gtr 0 (
|
||||||
|
%cmder_root%\vendor\bin\timer.cmd %cmder_init_start% %cmder_init_end%
|
||||||
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
4
vendor/profile.ps1
vendored
4
vendor/profile.ps1
vendored
@ -93,7 +93,7 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Enhance Path
|
# Enhance Path
|
||||||
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
|
$env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Prompt Section
|
# Prompt Section
|
||||||
@ -166,6 +166,8 @@ if ($ENV:CMDER_USER_CONFIG) {
|
|||||||
rename-item "$env:CMDER_USER_CONFIG\user-profile.ps1" user_profile.ps1
|
rename-item "$env:CMDER_USER_CONFIG\user-profile.ps1" user_profile.ps1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$env:Path = "$Env:CMDER_USER_CONFIG\bin;$env:Path"
|
||||||
|
|
||||||
$CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1"
|
$CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1"
|
||||||
if (Test-Path $CmderUserProfilePath) {
|
if (Test-Path $CmderUserProfilePath) {
|
||||||
Import-Module "$CmderUserProfilePath"
|
Import-Module "$CmderUserProfilePath"
|
||||||
|
Loading…
Reference in New Issue
Block a user