zxsh.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<#
    .Description
    Main (basic) module
 
    Sections:
 
    1. Script variable(s) declaration
    2. Script variable(s) initialization
    3. Source function(s)
    4. Define alias(es)
    5. Module member export definitions
     
#>


########################################
# 1. Script variable(s) declaration

$Script:PrevPwd             = $null
$Script:BranchName          = $null
$Script:GitBranchExitCode   = $null


########################################
# 2. Script variable(s) initialization

$Script:profilePath = [System.IO.Path]::GetDirectoryName($PROFILE)
if ($false -eq [System.IO.Directory]::Exists($Script:profilePath))
{
    New-Item $Script:profilePath -ItemType Directory
}


########################################
# 3. Source function(s)

# zxsh-functions.ps1
# 1. Set-Title
# 2. Prompt
. (Join-Path $PSScriptRoot zxsh-functions.ps1)


########################################
# 4. Define alias(es)

if ($null -eq (Get-Alias | Where-Object { $_.Name -like 'title' })) {
    New-Alias -Name title -Value Set-Title
}
if ($null -eq (Get-Alias | Where-Object { $_.Name -like 'isadmin' })) {
    New-Alias -Name isadmin -Value Test-IsAdmin
}


########################################
# 5. Module member export definitions

# Functions
Export-ModuleMember -Function Set-Title, Prompt, Get-EmptyFolders, Reset-Color, Get-IntegrityHash, ConvertTo-IntId, Test-IsAdmin

# Aliases
Export-ModuleMember -Alias title, isadmin