Browse Source

Better cross platform support

Edit-MyScript will pause if edit is running in background (conext
returning less than a second after launching editor)
Test-MyModules which loads at stratup now has specific platform lists
master
Gal Szkolnik 1 year ago
parent
commit
8566ea6863
6 changed files with 24 additions and 6 deletions
  1. +6
    -0
      Edit-MyScript.ps1
  2. +9
    -3
      profile.d/Test-MyModules.ps1
  3. +9
    -3
      src/modules.json
  4. +0
    -0
      sys.Linux/Update-ArchOSz.ps1
  5. +0
    -0
      sys.Linux/Update-OSz.ps1
  6. +0
    -0
      sys.Linux/Update-UbuntuOSz.ps1

+ 6
- 0
Edit-MyScript.ps1 View File

@@ -71,7 +71,13 @@ foreach( $local:p in $ScriptPaths ) {
}
}

$local:sw = [System.Diagnostics.Stopwatch]::StartNew();
Edit-TextFile $ScriptPaths
$sw.Stop();

if( $sw.Elapsed.TotalSeconds -lt 1 ) {
$null = Read-Host "Waiting before refreshing. Press <Enter> when you're done editing ( don't forget to save ;) )..."
}

Get-Command Reload-MyScripts -ErrorAction SilentlyContinue |
ForEach-Object { . $_.Definition }

+ 9
- 3
profile.d/Test-MyModules.ps1 View File

@@ -1,9 +1,15 @@
if( -not $global:MyModulesWarning ) {
param([switch]$Force)

$local:currentSys = [SystemName]::_GetValidValues('',$true,$true);

if( -not $global:MyModulesWarning -or $Force ) {
$global:MyModulesWarning = @()
}
[MyConfig]::GetConfigPaths('mymodules',$false) |
ForEach-Object {
$( Get-Content $_ | ConvertFrom-Json ).Modules
$local:modules = $( Get-Content $_ | ConvertFrom-Json );
$modules.Always;
$currentSys | ForEach-Object { $modules."$_" } | Where-Object { $_}
} | Where-Object {
$local:m = $_
if( $( try {
@@ -15,4 +21,4 @@ if( -not $global:MyModulesWarning ) {
} | ForEach-Object {
$global:MyModulesWarning += $_
Write-Warning "Missing module: $_"
}
}

+ 9
- 3
src/modules.json View File

@@ -1,8 +1,14 @@
{
"Modules": [
"Microsoft.PowerShell.UnixCompleters",
"Always": [
"PowerShellCookbook",
"oh-my-posh",
"posh-git"
"posh-git",
"z"
],
"Desktop": [
],
"Unix": [
"Microsoft.PowerShell.UnixCompleters"
]
}

Update-ArchOSz.ps1 → sys.Linux/Update-ArchOSz.ps1 View File


Update-OSz.ps1 → sys.Linux/Update-OSz.ps1 View File


Update-UbuntuOSz.ps1 → sys.Linux/Update-UbuntuOSz.ps1 View File


Loading…
Cancel
Save