-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrionDesign.psm1
More file actions
124 lines (107 loc) · 5.96 KB
/
OrionDesign.psm1
File metadata and controls
124 lines (107 loc) · 5.96 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<#
================================================================================
ORION DESIGN - POWERSHELL UI FRAMEWORK
================================================================================
Author: Sune Alexandersen Narud
Date: February 5, 2026
Version: 3.0.0
HIGH LEVEL DESIGN (HLD):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PURPOSE:
OrionDesign is a comprehensive PowerShell UI framework that provides beautiful,
consistent, and professional terminal user interfaces. It enables developers
and system administrators to create visually appealing command-line applications
with minimal effort.
ARCHITECTURE:
┌─────────────────┬─────────────────┬─────────────────┬─────────────────┐
│ INFORMATION │ STATUS & │ DATA │ INTERACTIVE │
│ DISPLAY │ RESULTS │ PRESENTATION │ ELEMENTS │
├─────────────────┼─────────────────┼─────────────────┼─────────────────┤
│ Write-Banner │ Write-ActionRes │ Write-Table │ Write-Menu │
│ Write-Header │ Write-Progress │ Write-Chart │ Write-Question │
│ Write-InfoBox │ Write-Steps │ Write-Comparison│ │
│ Write-Alert │ Write-Timeline │ Write-Dashboard │ │
└─────────────────┴─────────────────┴─────────────────┴─────────────────┘
┌─────────────────┬─────────────────┬─────────────────────────────────────┐
│ LAYOUT & │ GLOBAL │ DEMONSTRATION & UTILITIES │
│ FORMATTING │ CONFIGURATION │ │
├─────────────────┼─────────────────┼─────────────────────────────────────┤
│ Write-Separator │ Get-OrionMax │ Show-OrionDemo │
│ Write-Panel │ Set-OrionMax │ -Demo Basic/Themes/Interactive/All│
│ Write-CodeBlock │ $script:Theme │ Export-OrionHelpers (Portability) │
└─────────────────┴─────────────────┴─────────────────────────────────────┘
CORE FEATURES:
• 🎨 20 Beautiful UI Functions organized in logical categories
• 📏 Global Max Width Configuration (50-200 chars, default 100)
• 🎯 Consistent ANSI Styling with automatic ISE compatibility
• 📚 Complete Comment-Based Help documentation
• 🔧 Flexible Parameter Options with validation
• 💻 PowerShell ISE fallback support
• 🚀 Production-ready with comprehensive error handling
DESIGN PRINCIPLES:
1. CONSISTENCY - Unified styling and parameter patterns
2. FLEXIBILITY - Customizable through parameters and global config
3. COMPATIBILITY - Works in PowerShell 5.1+, ISE, and modern terminals
4. USABILITY - Intuitive function names and comprehensive help
5. PERFORMANCE - Optimized for speed with minimal dependencies
6. EXTENSIBILITY - Modular design for easy function additions
GLOBAL CONFIGURATION:
• $script:OrionMaxWidth (50-200): Controls output width for all functions
• $script:Theme: Color scheme and styling preferences
• ANSI Support: Automatic detection and graceful fallback
USAGE PATTERNS:
Import-Module OrionDesign
Write-Banner -ScriptName "MyApp" -Author "User" -Design Modern
Write-ActionResult -Action "Deploy" -Status Success -Details "Complete"
Set-OrionMaxWidth -Width 80 # Configure global width
Show-OrionDemo # See all functions in action
================================================================================
#>
Write-Verbose "DEBUG: OrionDesign.psm1 loaded. PSScriptRoot = $PSScriptRoot"
$root = $PSScriptRoot
# --- Global OrionDesign Configuration ---
# Maximum width/length for functions to prevent overly long output
$script:OrionMaxWidth = 100
# Default theme configuration
$script:Theme = @{
Accent = 'Cyan'
Success = 'Green'
Warning = 'Yellow'
Error = 'Red'
Text = 'White'
Muted = 'DarkGray'
Action = 'White'
Result = 'Cyan'
Divider = '─'
UseAnsi = $true
}
# Detect PowerShell ISE and disable ANSI if needed
if ($psISE) {
$script:Theme.UseAnsi = $false
}
# --- Load Private functions (internal only) ---
$privatePath = Join-Path $root 'Functions\Private'
if (Test-Path $privatePath) {
Get-ChildItem -Path $privatePath -Filter *.ps1 | ForEach-Object {
Write-Verbose "Loading private function: $($_.BaseName)"
. $_.FullName
}
}
# --- Load Public functions (to be exported) ---
$publicPath = Join-Path $root 'Functions\Public'
$publicFunctions = @()
if (Test-Path $publicPath) {
Get-ChildItem -Path $publicPath -Filter *.ps1 | ForEach-Object {
Write-Verbose "Loading public function: $($_.BaseName)"
. $_.FullName
$publicFunctions += $_.BaseName
}
}
# --- Export only public functions ---
if ($publicFunctions.Count -gt 0) {
Write-Verbose "Exporting functions: $($publicFunctions -join ', ')"
Export-ModuleMember -Function $publicFunctions
}
else {
Write-Warning "No public functions found to export from OrionDesign"
}