added a way to set custom functions

This commit is contained in:
unknown 2024-05-05 05:57:37 -07:00
parent 2cdf5fc247
commit e9ee029058
3 changed files with 21 additions and 0 deletions

4
omp-themes/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.zip
*.ttf
oldprofile.ps1

View File

@ -78,6 +78,9 @@ function prompt {
$adminSuffix = if ($isAdmin) { " [ADMIN]" } else { "" } $adminSuffix = if ($isAdmin) { " [ADMIN]" } else { "" }
$Host.UI.RawUI.WindowTitle = "PowerShell {0}$adminSuffix" -f $PSVersionTable.PSVersion.ToString() $Host.UI.RawUI.WindowTitle = "PowerShell {0}$adminSuffix" -f $PSVersionTable.PSVersion.ToString()
# Importing custom alias and functions
Import-Module $HOME\pwshalias\alias-and-functions.ps1
# Utility Functions # Utility Functions
function Test-CommandExists { function Test-CommandExists {
param($command) param($command)

View File

@ -21,6 +21,20 @@ if (-not (Test-InternetConnection)) {
break break
} }
# Powershell alias and funtions directory creaton
$pwshalias = "$HOME\pwshalias"
If(!(test-path -PathType container $pwshalias))
{
New-Item -ItemType Directory -Path $pwshalias
}
pwshaf = $pwshalias\alias-and-functions.ps1
if (!(Test-Path "$pwshaf"))
{
New-Item -path "$pwshalias" -name "alias-and-functions.ps1" -type "file" -value "## File Created"
Write-Host "Created new file and text content added"
}
# Profile creation or update # Profile creation or update
if (!(Test-Path -Path $PROFILE -PathType Leaf)) { if (!(Test-Path -Path $PROFILE -PathType Leaf)) {
try { try {