mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-16 14:47:49 +08:00
New cmder.exe args and shared install capability (#1696)
@MartiUK: Squashing to avoid adding multiple "fixed" commits * add args to init.bat * adding args to cmder launcher * reworked command line parsing and added a /C [path] arg for individual user config location * removed unnecessary includes * make shell init scripts work with CMDER_USER_CONFIG * update tasks and readme.md * fix git version check * readme updates * add register/unregister back in * fixed git version again * removed error if user defines user-aliases store file was not present an init.bat launch * added enhance_path method to only update path if required * added enhance_path method to only update path if required * fixed a path prepend issue in enhance path * init.bat with args is executed outside cmder/conemu sets cmder_root properly. Thanks @DRSDavidSoft * fixed enhance path append issue * implements recursive `/bin` path enhancing. https://github.com/cmderdev/cmder/issues/1624 * added max depth * changes command line arg to max_depth * set max_depth default * readme.md updates * add back cmder /c [path] arg so it can be used with admin sessions since the env is not shared. * readme.md updates * fix /c setting of cmder_user_config * changelog and readme * remove bad arg * fixed command line parsing and updated command line help on error * Fixed ConEmu.xml file handling so it works again * Added default user config root location if '/c' is specified and next arg is not another arg
This commit is contained in:
32
vendor/profile.ps1
vendored
32
vendor/profile.ps1
vendored
@ -9,6 +9,10 @@ if(!$PSScriptRoot) {
|
||||
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||
}
|
||||
|
||||
if ($ENV:CMDER_USER_CONFIG) {
|
||||
# write-host "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '$ENV:CMDER_USER_CONFIG'!"
|
||||
}
|
||||
|
||||
# We do this for Powershell as Admin Sessions because CMDER_ROOT is not beng set.
|
||||
if (! $ENV:CMDER_ROOT ) {
|
||||
if ( $ENV:ConEmuDir ) {
|
||||
@ -25,6 +29,10 @@ $ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
|
||||
# -> recent PowerShell versions include PowerShellGet out of the box
|
||||
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null)
|
||||
|
||||
# do not load bundled psget if a module installer is already available
|
||||
# -> recent PowerShell versions include PowerShellGet out of the box
|
||||
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null)
|
||||
|
||||
# Add Cmder modules directory to the autoload path.
|
||||
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
|
||||
|
||||
@ -130,10 +138,32 @@ foreach ($x in Get-ChildItem *.ps1) {
|
||||
}
|
||||
popd
|
||||
|
||||
# Drop *.ps1 files into "$ENV:CMDER_USER_CONFIG\config\profile.d"
|
||||
# to source them at startup. Requires using cmder.exe /C [cmder_user_root_path] argument
|
||||
if ($ENV:CMDER_USER_CONFIG -ne "" -and -not (test-path "$ENV:CMDER_USER_CONFIG\profile.d")) {
|
||||
pushd $ENV:CMDER_USER_CONFIG\profile.d
|
||||
foreach ($x in Get-ChildItem *.ps1) {
|
||||
# write-host write-host Sourcing $x
|
||||
. $x
|
||||
}
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
|
||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
|
||||
if(Test-Path $CmderUserProfilePath) {
|
||||
if (Test-Path $CmderUserProfilePath) {
|
||||
# Create this file and place your own command in there.
|
||||
. "$CmderUserProfilePath"
|
||||
|
||||
}
|
||||
|
||||
if ($ENV:CMDER_USER_CONFIG) {
|
||||
$CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user-profile.ps1"
|
||||
}
|
||||
|
||||
if (Test-Path $CmderUserProfilePath) {
|
||||
. "$CmderUserProfilePath"
|
||||
} else {
|
||||
# This multiline string cannot be indented, for this reason I've not indented the whole block
|
||||
|
||||
|
Reference in New Issue
Block a user