-
Notifications
You must be signed in to change notification settings - Fork 1
ss helper script
Atiq Rahman edited this page Nov 30, 2019
·
1 revision
Command line may not work appropriately with provided number of arguments.
Our past parsing method,
function ss() {
if ($args.Count -lt 1) {
return "Please provide correct commandline"
}
elseif ($args.Count -eq 1) {
& "$Env:PS_SC_DIR\ss.ps1" $args
}
else {
$cmd = $args[0]
echo "cmd: `"$cmd`""
$cargs = [string]$args
# echo "cargs: `"$cargs`""
$cargs = $cargs.Substring($cmd.Length-1)
# remove remaining spaces
$cargs = $cargs.TrimStart()
echo "cargs: `"$cargs`""
# try 1
# & "$Env:PS_SC_DIR\ss.ps1" $args[0] $cargs
# try 2
# & "$Env:PS_SC_DIR\ss.ps1" (, $args)
# try 3: experminent start-job
# Start-Job -filepath ss.ps1 -arg (,$args)
# try 4 invoke
# Invoke-Command -FilePath $sspath -ArgumentList (,$args)
# try 5 invoke
# Invoke-Command -ArgumentList (,$args) -ScriptBlock { ss }
# Write-Host "now args: $args"
# Write-Host "now args: $saArgs"
#$args.Remove(1)
#Write-Host "now args: $args"
& "$Env:PS_SC_DIR\ss.ps1" $saArgs
}
return ""
}
Then we changed to a better and simplier technique mentioned in pwsh Command Cache
- Misc section.
Currently we focus more on tech info regarding the shell.
SAOS Enterprise users only. Privileged and no 2fac.
Operating System Kernel Build
Net Core Build
PW Shell Version
Previous version of ShowHelp
,
Syntax for app path progs invocation,
start program arg1, arg2
Following command line options are available:
cd Go to home dir
ep Edit profile
eh Edit system hosts file
applist List available applications from app path
powershell Run powershell with administrator privilege
progname (deprecated) use app_path and start command instead
sgdm diffmerge (SourceGear) use VS Diff instead
winmerge Start alternative file comparison utility
help Show this help
Code,
function ShowHelp {
Write-Host "`r`nSS`: Cmd Assistant"
Write-Host "==========================================================="
Write-Host "Syntax for app path progs invocation,"
Write-Host " start program arg1, arg2"
Write-Host "Following command line options are available:"
Write-Host " cd`t`tGo to home dir"
Write-Host " ep`t`tEdit profile"
Write-Host " eh`t`tEdit system hosts file"
# Write-Host " git-cmd`tCreate env for git"
# Write-Host " ise`t`tPowershell_ise editor"
Write-Host " applist`tList available applications from app path"
Write-Host " powershell`tRun powershell with administrator privilege"
Write-Host " progname`t(deprecated) use app_path and start command instead"
# Write-Host " python`tCreate env for python"
Write-Host " sgdm`t`tdiffmerge (SourceGear) use VS Diff instead"
Write-Host " winmerge`tStart alternative file comparison utility"
# Write-Host " res--con`tResize console window dimension (Resize-Console)"
Write-Host " help`t`tShow this help`n"
}