├── .github └── FUNDING.yml ├── .gitignore ├── Build └── Manage-ConsoleMonster.ps1 ├── CHANGELOG.MD ├── ConsoleMonster.psd1 ├── ConsoleMonster.psm1 ├── Docs ├── New-SpectreImage.md ├── New-SpectreRule.md ├── New-Terminal.md ├── New-TerminalButton.md ├── New-TerminalCheckBox.md ├── New-TerminalRadioGroup.md ├── New-TerminalText.md ├── New-TerminalWindow.md └── Readme.md ├── Examples ├── Example-SpectreImage.ps1 ├── Example-SpectreRules.ps1 ├── Example-TerminaGUi.ps1 ├── Example-Terminal.ps1 ├── Images │ ├── Kulek.jpg │ └── PrzemyslawKlysAndKulkozaurr.jpg ├── Test.ps1 ├── Test1.ps1 └── Test2.ps1 ├── License ├── Public ├── New-SpectreImage.ps1 ├── New-SpectreRule.ps1 ├── New-Terminal.ps1 ├── New-TerminalButton.ps1 ├── New-TerminalCheckBox.ps1 ├── New-TerminalRadioGroup.ps1 ├── New-TerminalText.ps1 └── New-TerminalWindow.ps1 ├── README.MD └── Sources ├── ConsoleMonster.sln ├── ConsoleMonster.sln.DotSettings.user └── ConsoleMonster ├── ConsoleMonster.csproj ├── Initialize.cs └── OnImportAndRemove.cs /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: PrzemyslawKlys 2 | custom: https://paypal.me/PrzemyslawKlys -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Ignore/* 2 | .vs/* 3 | .vscode/* 4 | Examples/Output/* 5 | Releases/* 6 | Artefacts/* 7 | ReleasedUnpacked/* 8 | Sources/.vs 9 | Sources/*/.vs 10 | Sources/*/obj 11 | Sources/*/bin 12 | Sources/*/*/obj 13 | Sources/*/*/bin 14 | Sources/packages/* 15 | Lib/Default/* 16 | Lib/Standard/* 17 | Lib/Core/* -------------------------------------------------------------------------------- /Build/Manage-ConsoleMonster.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | 3 | Invoke-ModuleBuild -ModuleName 'ConsoleMonster' { 4 | # Usual defaults as per standard module 5 | $Manifest = [ordered] @{ 6 | ModuleVersion = '0.0.X' 7 | # Supported PSEditions 8 | CompatiblePSEditions = @('Desktop', 'Core') 9 | # ID used to uniquely identify this module 10 | GUID = '7ef2133c-55a5-47e6-809e-6010f6e65e09' 11 | # Author of this module 12 | Author = 'Przemyslaw Klys' 13 | # Company or vendor of this module 14 | CompanyName = 'Evotec' 15 | # Copyright statement for this module 16 | Copyright = "(c) 2011 - $((Get-Date).Year) Przemyslaw Klys @ Evotec. All rights reserved." 17 | # Description of the functionality provided by this module 18 | Description = 'Console Monster is a PowerShell module to build cool GUI applications using Spectre Console and Terminal GUI' 19 | # Minimum version of the Windows PowerShell engine required by this module 20 | PowerShellVersion = '5.1' 21 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 22 | Tags = @('Windows', 'MacOS', 'Linux') 23 | 24 | IconUri = 'https://evotec.xyz/wp-content/uploads/2022/08/ConsoleMonster-1.png' 25 | 26 | ProjectUri = 'https://github.com/EvotecIT/ConsoleMonster' 27 | 28 | DotNetFrameworkVersion = '4.7.2' 29 | } 30 | New-ConfigurationManifest @Manifest 31 | 32 | New-ConfigurationModule -Type ExternalModule -Name 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Management' 33 | #New-ConfigurationModule -Type RequiredModule -Name 'PSSharedGoods' -Version Latest -Guid Auto 34 | New-ConfigurationModule -Type ApprovedModule -Name 'PSSharedGoods', 'PSWriteColor', 'Connectimo', 'PSUnifi', 'PSWebToolbox', 'PSMyPassword', 'PSPublishModule' 35 | New-ConfigurationModuleSkip -IgnoreFunctionName 'Select-Unique' 36 | 37 | $ConfigurationFormat = [ordered] @{ 38 | RemoveComments = $false 39 | 40 | PlaceOpenBraceEnable = $true 41 | PlaceOpenBraceOnSameLine = $true 42 | PlaceOpenBraceNewLineAfter = $true 43 | PlaceOpenBraceIgnoreOneLineBlock = $false 44 | 45 | PlaceCloseBraceEnable = $true 46 | PlaceCloseBraceNewLineAfter = $true 47 | PlaceCloseBraceIgnoreOneLineBlock = $false 48 | PlaceCloseBraceNoEmptyLineBefore = $true 49 | 50 | UseConsistentIndentationEnable = $true 51 | UseConsistentIndentationKind = 'space' 52 | UseConsistentIndentationPipelineIndentation = 'IncreaseIndentationAfterEveryPipeline' 53 | UseConsistentIndentationIndentationSize = 4 54 | 55 | UseConsistentWhitespaceEnable = $true 56 | UseConsistentWhitespaceCheckInnerBrace = $true 57 | UseConsistentWhitespaceCheckOpenBrace = $true 58 | UseConsistentWhitespaceCheckOpenParen = $true 59 | UseConsistentWhitespaceCheckOperator = $true 60 | UseConsistentWhitespaceCheckPipe = $true 61 | UseConsistentWhitespaceCheckSeparator = $true 62 | 63 | AlignAssignmentStatementEnable = $true 64 | AlignAssignmentStatementCheckHashtable = $true 65 | 66 | UseCorrectCasingEnable = $true 67 | } 68 | # format PSD1 and PSM1 files when merging into a single file 69 | # enable formatting is not required as Configuration is provided 70 | New-ConfigurationFormat -ApplyTo 'OnMergePSM1', 'OnMergePSD1' -Sort None @ConfigurationFormat 71 | # format PSD1 and PSM1 files within the module 72 | # enable formatting is required to make sure that formatting is applied (with default settings) 73 | New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'DefaultPSM1' -EnableFormatting -Sort None 74 | # when creating PSD1 use special style without comments and with only required parameters 75 | New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'OnMergePSD1' -PSD1Style 'Minimal' 76 | # configuration for documentation, at the same time it enables documentation processing 77 | New-ConfigurationDocumentation -Enable:$true -StartClean -UpdateWhenNew -PathReadme 'Docs\Readme.md' -Path 'Docs' 78 | 79 | New-ConfigurationImportModule -ImportSelf 80 | 81 | $newConfigurationBuildSplat = @{ 82 | Enable = $true 83 | SignModule = $true 84 | MergeModuleOnBuild = $true 85 | MergeFunctionsFromApprovedModules = $true 86 | CertificateThumbprint = '483292C9E317AA13B07BB7A96AE9D1A5ED9E7703' 87 | ResolveBinaryConflicts = $true 88 | ResolveBinaryConflictsName = 'ConsoleMonster' 89 | NETProjectName = 'ConsoleMonster' 90 | NETConfiguration = 'Release' 91 | NETFramework = 'netstandard2.0', 'net472' 92 | DotSourceLibraries = $true 93 | DeleteTargetModuleBeforeBuild = $true 94 | NETHandleAssemblyWithSameName = $true 95 | } 96 | 97 | New-ConfigurationBuild @newConfigurationBuildSplat 98 | 99 | New-ConfigurationArtefact -Type Unpacked -Enable -Path "$PSScriptRoot\..\Artefacts\Unpacked" -ModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\Modules" -RequiredModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\Modules" -AddRequiredModules 100 | New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed" -ArtefactName '.v.zip' 101 | 102 | # global options for publishing to github/psgallery 103 | #New-ConfigurationPublish -Type PowerShellGallery -FilePath 'C:\Support\Important\PowerShellGalleryAPI.txt' -Enabled:$true 104 | #New-ConfigurationPublish -Type GitHub -FilePath 'C:\Support\Important\GitHubAPI.txt' -UserName 'EvotecIT' -Enabled:$true 105 | } -------------------------------------------------------------------------------- /CHANGELOG.MD: -------------------------------------------------------------------------------- 1 | ### 0.0.4 - 2024.10.26 2 | #### What's new 3 | - Bump dependencies 4 | - Small fixes 5 | 6 | #### What's Changed 7 | * Bump SixLabors.ImageSharp from 2.1.3 to 2.1.7 in /Sources/ConsoleMonster by @dependabot in https://github.com/EvotecIT/ConsoleMonster/pull/2 8 | * Bump SixLabors.ImageSharp from 2.1.7 to 2.1.8 in /Sources/ConsoleMonster by @dependabot in https://github.com/EvotecIT/ConsoleMonster/pull/3 9 | 10 | #### New Contributors 11 | * @dependabot made their first contribution in https://github.com/EvotecIT/ConsoleMonster/pull/2 12 | 13 | **Full Changelog**: https://github.com/EvotecIT/ConsoleMonster/compare/v0.0.3...v0.0.4 14 | ### 0.0.3 - 2023.01.01 15 | - Removed Libraries from GIT, you will have to build them using PSPublishModule in the builds folder if you want to play with GIT version 16 | - Updated versions of libraries: 17 | - Spectre.Console 0.45.0 18 | - Terminal.Gui 1.8.2 19 | 20 | ### 0.0.2 - 2022.09.06 21 | - Improve `New-SpectreImage` to take URL as input 22 | - Small improvements for other cmdlets but really WIP 23 | 24 | ### 0.0.1 - 2022.08.28 25 | - Initial release to test things out -------------------------------------------------------------------------------- /ConsoleMonster.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | AliasesToExport = @() 3 | Author = 'Przemyslaw Klys' 4 | CmdletsToExport = @() 5 | CompanyName = 'Evotec' 6 | CompatiblePSEditions = @('Desktop', 'Core') 7 | Copyright = '(c) 2011 - 2024 Przemyslaw Klys @ Evotec. All rights reserved.' 8 | Description = 'Console Monster is a PowerShell module to build cool GUI applications using Spectre Console and Terminal GUI' 9 | DotNetFrameworkVersion = '4.7.2' 10 | FunctionsToExport = @('New-SpectreImage', 'New-SpectreRule', 'New-Terminal', 'New-TerminalButton', 'New-TerminalCheckBox', 'New-TerminalRadioGroup', 'New-TerminalText', 'New-TerminalWindow') 11 | GUID = '7ef2133c-55a5-47e6-809e-6010f6e65e09' 12 | ModuleVersion = '0.0.4' 13 | PowerShellVersion = '5.1' 14 | PrivateData = @{ 15 | PSData = @{ 16 | ExternalModuleDependencies = @('Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Management') 17 | IconUri = 'https://evotec.xyz/wp-content/uploads/2022/08/ConsoleMonster-1.png' 18 | ProjectUri = 'https://github.com/EvotecIT/ConsoleMonster' 19 | Tags = @('Windows', 'MacOS', 'Linux') 20 | } 21 | } 22 | RequiredModules = @('Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Management') 23 | RootModule = 'ConsoleMonster.psm1' 24 | } -------------------------------------------------------------------------------- /ConsoleMonster.psm1: -------------------------------------------------------------------------------- 1 | # Get public and private function definition files. 2 | $Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 3 | $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 4 | $Classes = @( Get-ChildItem -Path $PSScriptRoot\Classes\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 5 | $Enums = @( Get-ChildItem -Path $PSScriptRoot\Enums\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 6 | # Get all assemblies 7 | $AssemblyFolders = Get-ChildItem -Path $PSScriptRoot\Lib -Directory -ErrorAction SilentlyContinue 8 | 9 | # Lets find which libraries we need to load 10 | $Default = $false 11 | $Core = $false 12 | $Standard = $false 13 | foreach ($A in $AssemblyFolders.Name) { 14 | if ($A -eq 'Default') { 15 | $Default = $true 16 | } elseif ($A -eq 'Core') { 17 | $Core = $true 18 | } elseif ($A -eq 'Standard') { 19 | $Standard = $true 20 | } 21 | } 22 | if ($Standard -and $Core -and $Default) { 23 | $FrameworkNet = 'Default' 24 | $Framework = 'Standard' 25 | } elseif ($Standard -and $Core) { 26 | $Framework = 'Standard' 27 | $FrameworkNet = 'Standard' 28 | } elseif ($Core -and $Default) { 29 | $Framework = 'Core' 30 | $FrameworkNet = 'Default' 31 | } elseif ($Standard -and $Default) { 32 | $Framework = 'Standard' 33 | $FrameworkNet = 'Default' 34 | } elseif ($Standard) { 35 | $Framework = 'Standard' 36 | $FrameworkNet = 'Standard' 37 | } elseif ($Core) { 38 | $Framework = 'Core' 39 | $FrameworkNet = '' 40 | } elseif ($Default) { 41 | $Framework = '' 42 | $FrameworkNet = 'Default' 43 | } else { 44 | Write-Error -Message 'No assemblies found' 45 | } 46 | if ($PSEdition -eq 'Core') { 47 | $LibFolder = $Framework 48 | } else { 49 | $LibFolder = $FrameworkNet 50 | } 51 | 52 | $Assembly = @( 53 | if ($Framework -and $PSEdition -eq 'Core') { 54 | Get-ChildItem -Path $PSScriptRoot\Lib\$Framework\*.dll -ErrorAction SilentlyContinue -Recurse 55 | } 56 | if ($FrameworkNet -and $PSEdition -ne 'Core') { 57 | Get-ChildItem -Path $PSScriptRoot\Lib\$FrameworkNet\*.dll -ErrorAction SilentlyContinue -Recurse 58 | } 59 | # if ($AssemblyFolders.BaseName -contains 'Standard') { 60 | # @( Get-ChildItem -Path $PSScriptRoot\Lib\Standard\*.dll -ErrorAction SilentlyContinue -Recurse) 61 | # } 62 | # if ($PSEdition -eq 'Core') { 63 | # @( Get-ChildItem -Path $PSScriptRoot\Lib\Core\*.dll -ErrorAction SilentlyContinue -Recurse ) 64 | # } else { 65 | # @( Get-ChildItem -Path $PSScriptRoot\Lib\Default\*.dll -ErrorAction SilentlyContinue -Recurse ) 66 | # } 67 | ) 68 | 69 | # This is special way of importing DLL if multiple frameworks are in use 70 | $FoundErrors = @( 71 | # We load the DLL that does OnImportRemove if we have special module that requires special treatment for binary modules 72 | 73 | # Get library name, from the PSM1 file name 74 | $LibraryName = $myInvocation.MyCommand.Name.Replace(".psm1", "") 75 | $Library = "$LibraryName.dll" 76 | $Class = "$LibraryName.Initialize" 77 | 78 | try { 79 | $ImportModule = Get-Command -Name Import-Module -Module Microsoft.PowerShell.Core 80 | 81 | if (-not ($Class -as [type])) { 82 | & $ImportModule ([IO.Path]::Combine($PSScriptRoot, 'Lib', $LibFolder, $Library)) -ErrorAction Stop 83 | } else { 84 | $Type = "$Class" -as [Type] 85 | & $importModule -Force -Assembly ($Type.Assembly) 86 | } 87 | } catch { 88 | Write-Warning -Message "Importing module $Library failed. Fix errors before continuing. Error: $($_.Exception.Message)" 89 | $true 90 | } 91 | 92 | Foreach ($Import in @($Assembly)) { 93 | try { 94 | Add-Type -Path $Import.Fullname -ErrorAction Stop 95 | } catch [System.Reflection.ReflectionTypeLoadException] { 96 | Write-Warning "Processing $($Import.Name) Exception: $($_.Exception.Message)" 97 | $LoaderExceptions = $($_.Exception.LoaderExceptions) | Sort-Object -Unique 98 | foreach ($E in $LoaderExceptions) { 99 | Write-Warning "Processing $($Import.Name) LoaderExceptions: $($E.Message)" 100 | } 101 | $true 102 | } catch { 103 | Write-Warning "Processing $($Import.Name) Exception: $($_.Exception.Message)" 104 | $LoaderExceptions = $($_.Exception.LoaderExceptions) | Sort-Object -Unique 105 | foreach ($E in $LoaderExceptions) { 106 | Write-Warning "Processing $($Import.Name) LoaderExceptions: $($E.Message)" 107 | } 108 | $true 109 | } 110 | } 111 | 112 | #Dot source the files 113 | Foreach ($Import in @($Private + $Classes + $Enums + $Public)) { 114 | Try { 115 | . $Import.Fullname 116 | } Catch { 117 | Write-Warning -Message "Failed to import functions from $($import.Fullname).Error: $($_.Exception.Message)" 118 | $true 119 | } 120 | } 121 | ) 122 | 123 | if ($FoundErrors.Count -gt 0) { 124 | $ModuleName = (Get-ChildItem $PSScriptRoot\*.psd1).BaseName 125 | Write-Warning "Importing module $ModuleName failed. Fix errors before continuing." 126 | break 127 | } 128 | 129 | Export-ModuleMember -Function '*' -Alias '*' -Cmdlet '*' -------------------------------------------------------------------------------- /Docs/New-SpectreImage.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-SpectreImage 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ### File 16 | ``` 17 | New-SpectreImage -FilePath [-MaxWidth ] [-ProgressAction ] 18 | [] 19 | ``` 20 | 21 | ### Url 22 | ``` 23 | New-SpectreImage -Uri [-MaxWidth ] [-ProgressAction ] [] 24 | ``` 25 | 26 | ## DESCRIPTION 27 | {{ Fill in the Description }} 28 | 29 | ## EXAMPLES 30 | 31 | ### Example 1 32 | ```powershell 33 | PS C:\> {{ Add example code here }} 34 | ``` 35 | 36 | {{ Add example description here }} 37 | 38 | ## PARAMETERS 39 | 40 | ### -FilePath 41 | {{ Fill FilePath Description }} 42 | 43 | ```yaml 44 | Type: String 45 | Parameter Sets: File 46 | Aliases: 47 | 48 | Required: True 49 | Position: Named 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -MaxWidth 56 | {{ Fill MaxWidth Description }} 57 | 58 | ```yaml 59 | Type: Int32 60 | Parameter Sets: (All) 61 | Aliases: 62 | 63 | Required: False 64 | Position: Named 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -Uri 71 | {{ Fill Uri Description }} 72 | 73 | ```yaml 74 | Type: Uri 75 | Parameter Sets: Url 76 | Aliases: 77 | 78 | Required: True 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### -ProgressAction 86 | {{ Fill ProgressAction Description }} 87 | 88 | ```yaml 89 | Type: ActionPreference 90 | Parameter Sets: (All) 91 | Aliases: proga 92 | 93 | Required: False 94 | Position: Named 95 | Default value: None 96 | Accept pipeline input: False 97 | Accept wildcard characters: False 98 | ``` 99 | 100 | ### CommonParameters 101 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 102 | 103 | ## INPUTS 104 | 105 | ### None 106 | 107 | ## OUTPUTS 108 | 109 | ### System.Object 110 | ## NOTES 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /Docs/New-SpectreRule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-SpectreRule 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-SpectreRule [[-Text] ] [[-Color] ] [[-Align] ] [[-RuleStyle] ] 17 | [[-RuleColor] ] [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Align 35 | {{ Fill Align Description }} 36 | 37 | ```yaml 38 | Type: Justify 39 | Parameter Sets: (All) 40 | Aliases: Justification 41 | Accepted values: Left, Right, Center 42 | 43 | Required: False 44 | Position: 2 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### -Color 51 | {{ Fill Color Description }} 52 | 53 | ```yaml 54 | Type: Array 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 1 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -RuleColor 66 | {{ Fill RuleColor Description }} 67 | 68 | ```yaml 69 | Type: String 70 | Parameter Sets: (All) 71 | Aliases: 72 | 73 | Required: False 74 | Position: 4 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -RuleStyle 81 | {{ Fill RuleStyle Description }} 82 | 83 | ```yaml 84 | Type: String 85 | Parameter Sets: (All) 86 | Aliases: 87 | Accepted values: bold, dim, italic, underline, invert, conceal, slowblink, rapidblink, strikethrough 88 | 89 | Required: False 90 | Position: 3 91 | Default value: None 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### -Text 97 | {{ Fill Text Description }} 98 | 99 | ```yaml 100 | Type: Array 101 | Parameter Sets: (All) 102 | Aliases: 103 | 104 | Required: False 105 | Position: 0 106 | Default value: None 107 | Accept pipeline input: False 108 | Accept wildcard characters: False 109 | ``` 110 | 111 | ### -ProgressAction 112 | {{ Fill ProgressAction Description }} 113 | 114 | ```yaml 115 | Type: ActionPreference 116 | Parameter Sets: (All) 117 | Aliases: proga 118 | 119 | Required: False 120 | Position: Named 121 | Default value: None 122 | Accept pipeline input: False 123 | Accept wildcard characters: False 124 | ``` 125 | 126 | ### CommonParameters 127 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 128 | 129 | ## INPUTS 130 | 131 | ### None 132 | 133 | ## OUTPUTS 134 | 135 | ### System.Object 136 | ## NOTES 137 | 138 | ## RELATED LINKS 139 | -------------------------------------------------------------------------------- /Docs/New-Terminal.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-Terminal 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-Terminal [[-Application] ] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### -Application 34 | {{ Fill Application Description }} 35 | 36 | ```yaml 37 | Type: ScriptBlock 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 0 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -ProgressAction 49 | {{ Fill ProgressAction Description }} 50 | 51 | ```yaml 52 | Type: ActionPreference 53 | Parameter Sets: (All) 54 | Aliases: proga 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | 70 | ## OUTPUTS 71 | 72 | ### System.Object 73 | ## NOTES 74 | 75 | ## RELATED LINKS 76 | -------------------------------------------------------------------------------- /Docs/New-TerminalButton.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TerminalButton 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-TerminalButton [[-Command] ] [[-Text] ] [[-X] ] [[-Y] ] 17 | [-DisableAutosize] [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Command 35 | {{ Fill Command Description }} 36 | 37 | ```yaml 38 | Type: ScriptBlock 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: False 43 | Position: 0 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -DisableAutosize 50 | {{ Fill DisableAutosize Description }} 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Text 65 | {{ Fill Text Description }} 66 | 67 | ```yaml 68 | Type: String 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 1 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -X 80 | {{ Fill X Description }} 81 | 82 | ```yaml 83 | Type: Int32 84 | Parameter Sets: (All) 85 | Aliases: 86 | 87 | Required: False 88 | Position: 2 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -Y 95 | {{ Fill Y Description }} 96 | 97 | ```yaml 98 | Type: Int32 99 | Parameter Sets: (All) 100 | Aliases: 101 | 102 | Required: False 103 | Position: 3 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### -ProgressAction 110 | {{ Fill ProgressAction Description }} 111 | 112 | ```yaml 113 | Type: ActionPreference 114 | Parameter Sets: (All) 115 | Aliases: proga 116 | 117 | Required: False 118 | Position: Named 119 | Default value: None 120 | Accept pipeline input: False 121 | Accept wildcard characters: False 122 | ``` 123 | 124 | ### CommonParameters 125 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 126 | 127 | ## INPUTS 128 | 129 | ### None 130 | 131 | ## OUTPUTS 132 | 133 | ### System.Object 134 | ## NOTES 135 | 136 | ## RELATED LINKS 137 | -------------------------------------------------------------------------------- /Docs/New-TerminalCheckBox.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TerminalCheckBox 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-TerminalCheckBox [[-Text] ] [[-X] ] [[-Y] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Text 35 | {{ Fill Text Description }} 36 | 37 | ```yaml 38 | Type: String[] 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: False 43 | Position: 0 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -X 50 | {{ Fill X Description }} 51 | 52 | ```yaml 53 | Type: Int32 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: 1 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Y 65 | {{ Fill Y Description }} 66 | 67 | ```yaml 68 | Type: Int32 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 2 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ### None 100 | 101 | ## OUTPUTS 102 | 103 | ### System.Object 104 | ## NOTES 105 | 106 | ## RELATED LINKS 107 | -------------------------------------------------------------------------------- /Docs/New-TerminalRadioGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TerminalRadioGroup 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-TerminalRadioGroup [[-Text] ] [[-X] ] [[-Y] ] [[-Selected] ] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Selected 35 | {{ Fill Selected Description }} 36 | 37 | ```yaml 38 | Type: Int32 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: False 43 | Position: 3 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -Text 50 | {{ Fill Text Description }} 51 | 52 | ```yaml 53 | Type: String[] 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: 0 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -X 65 | {{ Fill X Description }} 66 | 67 | ```yaml 68 | Type: Int32 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 1 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Y 80 | {{ Fill Y Description }} 81 | 82 | ```yaml 83 | Type: Int32 84 | Parameter Sets: (All) 85 | Aliases: 86 | 87 | Required: False 88 | Position: 2 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -ProgressAction 95 | {{ Fill ProgressAction Description }} 96 | 97 | ```yaml 98 | Type: ActionPreference 99 | Parameter Sets: (All) 100 | Aliases: proga 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ### None 115 | 116 | ## OUTPUTS 117 | 118 | ### System.Object 119 | ## NOTES 120 | 121 | ## RELATED LINKS 122 | -------------------------------------------------------------------------------- /Docs/New-TerminalText.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TerminalText 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-TerminalText [[-X] ] [[-Y] ] [[-Width] ] [-Text] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Text 35 | {{ Fill Text Description }} 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 3 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -Width 50 | {{ Fill Width Description }} 51 | 52 | ```yaml 53 | Type: Int32 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -X 65 | {{ Fill X Description }} 66 | 67 | ```yaml 68 | Type: Int32 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 0 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Y 80 | {{ Fill Y Description }} 81 | 82 | ```yaml 83 | Type: Int32 84 | Parameter Sets: (All) 85 | Aliases: 86 | 87 | Required: False 88 | Position: 1 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -ProgressAction 95 | {{ Fill ProgressAction Description }} 96 | 97 | ```yaml 98 | Type: ActionPreference 99 | Parameter Sets: (All) 100 | Aliases: proga 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ### None 115 | 116 | ## OUTPUTS 117 | 118 | ### System.Object 119 | ## NOTES 120 | 121 | ## RELATED LINKS 122 | -------------------------------------------------------------------------------- /Docs/New-TerminalWindow.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ConsoleMonster-help.xml 3 | Module Name: ConsoleMonster 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-TerminalWindow 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-TerminalWindow [[-WindowContent] ] [[-Title] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ```powershell 27 | PS C:\> {{ Add example code here }} 28 | ``` 29 | 30 | {{ Add example description here }} 31 | 32 | ## PARAMETERS 33 | 34 | ### -Title 35 | {{ Fill Title Description }} 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: False 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -WindowContent 50 | {{ Fill WindowContent Description }} 51 | 52 | ```yaml 53 | Type: ScriptBlock 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: 0 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -ProgressAction 65 | {{ Fill ProgressAction Description }} 66 | 67 | ```yaml 68 | Type: ActionPreference 69 | Parameter Sets: (All) 70 | Aliases: proga 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ### None 85 | 86 | ## OUTPUTS 87 | 88 | ### System.Object 89 | ## NOTES 90 | 91 | ## RELATED LINKS 92 | -------------------------------------------------------------------------------- /Docs/Readme.md: -------------------------------------------------------------------------------- 1 | --- 2 | Module Name: ConsoleMonster 3 | Module Guid: 7ef2133c-55a5-47e6-809e-6010f6e65e09 4 | Download Help Link: {{ Update Download Link }} 5 | Help Version: {{ Please enter version of help manually (X.X.X.X) format }} 6 | Locale: en-US 7 | --- 8 | 9 | # ConsoleMonster Module 10 | ## Description 11 | {{ Fill in the Description }} 12 | 13 | ## ConsoleMonster Cmdlets 14 | ### [New-SpectreImage](New-SpectreImage.md) 15 | {{ Fill in the Synopsis }} 16 | 17 | ### [New-SpectreRule](New-SpectreRule.md) 18 | {{ Fill in the Synopsis }} 19 | 20 | ### [New-Terminal](New-Terminal.md) 21 | {{ Fill in the Synopsis }} 22 | 23 | ### [New-TerminalButton](New-TerminalButton.md) 24 | {{ Fill in the Synopsis }} 25 | 26 | ### [New-TerminalCheckBox](New-TerminalCheckBox.md) 27 | {{ Fill in the Synopsis }} 28 | 29 | ### [New-TerminalRadioGroup](New-TerminalRadioGroup.md) 30 | {{ Fill in the Synopsis }} 31 | 32 | ### [New-TerminalText](New-TerminalText.md) 33 | {{ Fill in the Synopsis }} 34 | 35 | ### [New-TerminalWindow](New-TerminalWindow.md) 36 | {{ Fill in the Synopsis }} 37 | 38 | -------------------------------------------------------------------------------- /Examples/Example-SpectreImage.ps1: -------------------------------------------------------------------------------- 1 | Import-Module $PSScriptRoot\..\ConsoleMonster.psd1 -Force 2 | 3 | New-SpectreImage -FilePath "$PSScriptRoot\Images\Kulek.jpg" 4 | New-SpectreImage -FilePath "$PSScriptRoot\Images\PrzemyslawKlysAndKulkozaurr.jpg" 5 | New-SpectreImage -Uri 'https://upload.wikimedia.org/wikipedia/en/2/21/Web_of_Spider-Man_Vol_1_129-1.png' -------------------------------------------------------------------------------- /Examples/Example-SpectreRules.ps1: -------------------------------------------------------------------------------- 1 | Import-Module .\ConsoleMonster.psd1 -Force 2 | 3 | New-SpectreRule -Text 'This is my rules!', 'centered' -Color yellow, green -RuleColor blue 4 | New-SpectreRule -Text 'This is my rules!', 'left aligned' -Color yellow, green -RuleColor blue -Align Left -------------------------------------------------------------------------------- /Examples/Example-TerminaGUi.ps1: -------------------------------------------------------------------------------- 1 | Import-Module .\ConsoleMonster.psd1 -Force 2 | 3 | [Terminal.Gui.Application]::Init() 4 | 5 | $win = [Terminal.Gui.Window] @{ 6 | Title = 'Hello World' 7 | } 8 | 9 | $edt = [Terminal.Gui.TextField] @{ 10 | X = [Terminal.Gui.Pos]::Center() 11 | Y = [Terminal.Gui.Pos]::Center() 12 | Width = 20 13 | Text = 'This text will be returned' 14 | } 15 | $win.Add($edt) 16 | 17 | for ($i = 0; $i -lt 30; $i++) { 18 | $Check = [Terminal.Gui.CheckBox] @{ 19 | X = [Terminal.Gui.Pos]::Center() 20 | Y = [Terminal.Gui.Pos]::Center() + $i 21 | Text = "Option $i" 22 | } 23 | $win.Add($Check) 24 | } 25 | 26 | # $btn = [Terminal.Gui.Button] @{ 27 | # X = [Terminal.Gui.Pos]::Center() 28 | # Y = [Terminal.Gui.Pos]::Center() + 1 29 | # Text = 'Option 1' 30 | # } 31 | # $win.Add($btn) 32 | 33 | $btn = [Terminal.Gui.Button] @{ 34 | X = [Terminal.Gui.Pos]::Center() + 20 35 | Y = [Terminal.Gui.Pos]::Center() + 2 36 | Text = 'Quit' 37 | } 38 | $win.Add($btn) 39 | 40 | 41 | [Terminal.Gui.Application]::Top.Add($win) 42 | 43 | # Attach an event handler to the button. 44 | # Note: Register-ObjectEvent -Action is NOT an option, because 45 | # the [Application]::Run() method used to display the window is blocking. 46 | $btn.add_Clicked( { 47 | # Close the modal window. 48 | # This call is also necessary to stop printing garbage in response to mouse 49 | # movements later. 50 | [Terminal.Gui.Application]::RequestStop() 51 | }) 52 | 53 | # Show the window (takes over the whole screen). 54 | # Note: This is a blocking call. 55 | [Terminal.Gui.Application]::Run() 56 | 57 | # As of 1.0.0-pre.4, at least on macOS, the following two statements 58 | # are necessary on in order for the terminal to behave properly again. 59 | [Terminal.Gui.Application]::Shutdown() # Clears the screen too; required for being able to rerun the application in the same session. 60 | 61 | # Output something 62 | $edt.Text.ToString() -------------------------------------------------------------------------------- /Examples/Example-Terminal.ps1: -------------------------------------------------------------------------------- 1 | Import-Module .\ConsoleMonster.psd1 -Force 2 | 3 | New-Terminal { 4 | New-TerminalWindow -Title 'Test' { 5 | New-TerminalText -Text 'Special Text' -Width 20 -X 20 6 | New-TerminalButton -Text "Quit" -X 2 -Y 20 -Command { 7 | 8 | } 9 | New-TerminalRadioGroup -Text "one", 'Two', 'Three' -X 10 -Y 30 10 | 11 | 12 | New-TerminalCheckBox -Text "CheckBox1" -X 10 -Y 50 13 | New-TerminalCheckBox -Text "CheckBox2" -X 10 -Y 60 14 | New-TerminalCheckBox -Text "CheckBox3" -X 10 -Y 70 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Examples/Images/Kulek.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/ConsoleMonster/b5687afdaae33f3b618a38bdbe6a14111820b7f3/Examples/Images/Kulek.jpg -------------------------------------------------------------------------------- /Examples/Images/PrzemyslawKlysAndKulkozaurr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/ConsoleMonster/b5687afdaae33f3b618a38bdbe6a14111820b7f3/Examples/Images/PrzemyslawKlysAndKulkozaurr.jpg -------------------------------------------------------------------------------- /Examples/Test.ps1: -------------------------------------------------------------------------------- 1 | Import-Module .\ConsoleMonster.psd1 -Force 2 | 3 | #[AnsiConsole].Markup("[underline red]Hello[/] World!"); 4 | 5 | #[Spectre.Console.AnsiConsole]::Markup("[underline red]Hello[/] World!") 6 | 7 | $Table = [Spectre.Console.Table]::new() 8 | 9 | [Spectre.Console.] 10 | [Spectre.Console.TableRow]::new 11 | 12 | $Table.Rows.Add(2) 13 | 14 | $AnsiTable = [Spectre.Console.AnsiConsole]::Live($Table) 15 | $AnsiTable.Start({ 16 | #$table.AddColumn("Foo"); 17 | #$table.AddColumn("Foo"); 18 | }) -------------------------------------------------------------------------------- /Examples/Test1.ps1: -------------------------------------------------------------------------------- 1 | [Spectre.Console.AnsiConsole]::Status().Start("Thinking...", { 2 | #// Simulate some work 3 | [Spectre.Console.AnsiConsole]::MarkupLine("Doing some work..."); 4 | #Thread.Sleep(1000); 5 | 6 | #// Update the status and spinner 7 | $ctx.Status("Thinking some more"); 8 | $ctx.Spinner([Spectre.Console.Spinner+Known]::Star); 9 | $ctx.SpinnerStyle([Spectre.Console.Style]::Parse("green")); 10 | 11 | #// Simulate some work 12 | [Spectre.Console.AnsiConsole]::MarkupLine("Doing some more work..."); 13 | #Thread.Sleep(2000); 14 | } 15 | ); -------------------------------------------------------------------------------- /Examples/Test2.ps1: -------------------------------------------------------------------------------- 1 | $table = [Spectre.Console.Table]::new() 2 | $table.AddColumn([Spectre.Console.TableColumn]::new([Spectre.Console.Markup]::new("[yellow]Foo[/]"))); 3 | $table.AddColumn([Spectre.Console.TableColumn]::new("[blue]Bar[/]")); 4 | $table.AddRow("Baz", "[green]Qux[/]"); 5 | $table.AddRow( [Spectre.Console.Markup]::new("[blue]Corgi[/]"), [Spectre.Console.Panel]::new("Waldo")); 6 | 7 | 8 | [Spectre.Console.AnsiConsole]::Render($table); -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Evotec 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Public/New-SpectreImage.ps1: -------------------------------------------------------------------------------- 1 | function New-SpectreImage { 2 | [CmdletBinding()] 3 | param( 4 | [Parameter(Mandatory, ParameterSetName = 'File')][string] $FilePath, 5 | [Parameter(Mandatory, ParameterSetName = 'Url')][alias()][Uri] $Uri, 6 | [int] $MaxWidth 7 | ) 8 | if ($Uri) { 9 | $Extension = [IO.Path]::GetExtension($Uri.AbsolutePath) 10 | $FilePath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "$($([System.IO.Path]::GetRandomFileName()).Split('.')[0]).$Extension") 11 | $ProgressPreference = 'SilentlyContinue' 12 | Try { 13 | Invoke-WebRequest -Uri $Uri -OutFile $FilePath -ErrorAction Stop 14 | } Catch { 15 | Write-Warning -Message "Failed to download image from $($Uri.AbsoluteUri)" 16 | Return 17 | } 18 | 19 | } 20 | if ($FilePath -and (Test-Path -Path $FilePath)) { 21 | $Image = [Spectre.Console.CanvasImage]::new($FilePath) 22 | } 23 | if ($MaxWidth) { 24 | $Image.MaxWidth = $MaxWidth 25 | } 26 | # $Image = [Spectre.Console.CanvasImageExtensions]::BicubicResampler($Image) 27 | # $Image 28 | 29 | [Spectre.Console.AnsiConsole]::Write($Image) 30 | } -------------------------------------------------------------------------------- /Public/New-SpectreRule.ps1: -------------------------------------------------------------------------------- 1 | function New-SpectreRule { 2 | [cmdletBinding()] 3 | param( 4 | [Array] $Text, 5 | [Array] $Color, 6 | [Alias('Justification')][Spectre.Console.Justify] $Align, 7 | [validateSet('bold', 'dim', 'italic', 'underline', 'invert', 'conceal', 'slowblink', 'rapidblink', 'strikethrough')][string] $RuleStyle, 8 | [string] $RuleColor 9 | ) 10 | $DefaultColor = $Color[0] 11 | $PreparedText = if ($Text.Count -ne 0) { 12 | for ($i = 0; $i -lt $Text.Length; $i++ ) { 13 | if ($Color[$i]) { 14 | "[$($Color[$i])]$($Text[$i])[/]" 15 | } elseif ($DefaultColor) { 16 | "[$($DefaultColor)]$($Text[$i])[/]" 17 | } else { 18 | "$($Text[$i])" 19 | } 20 | } 21 | } 22 | $rule = [Spectre.Console.Rule]::new($PreparedText) 23 | $rule.Justification = $Align 24 | if ($RuleColor -and $Style) { 25 | $rule.Style = "$RuleColor $style" 26 | } elseif ($RuleColor) { 27 | $Rule.Style = $RuleColor 28 | } elseif ($Style) { 29 | $Rule.Style = $Style 30 | } 31 | [Spectre.Console.AnsiConsole]::Render($rule) 32 | } -------------------------------------------------------------------------------- /Public/New-Terminal.ps1: -------------------------------------------------------------------------------- 1 | function New-Terminal { 2 | [cmdletBinding()] 3 | param( 4 | [ScriptBlock] $Application 5 | ) 6 | 7 | [Terminal.Gui.Application]::Init() 8 | 9 | if ($Application) { 10 | $OutputApp = & $Application 11 | foreach ($O in $OutputApp) { 12 | [Terminal.Gui.Application]::Top.Add($O) 13 | } 14 | } 15 | 16 | # Show the window (takes over the whole screen). 17 | # Note: This is a blocking call. 18 | [Terminal.Gui.Application]::Run() 19 | 20 | [Terminal.Gui.Application]::Shutdown() # Clears the screen too; required for being able to rerun the application in the same session. 21 | } -------------------------------------------------------------------------------- /Public/New-TerminalButton.ps1: -------------------------------------------------------------------------------- 1 | function New-TerminalButton { 2 | [cmdletBinding()] 3 | param( 4 | [scriptblock] $Command, 5 | [string] $Text, 6 | [int] $X, 7 | [int] $Y, 8 | [switch] $DisableAutosize 9 | ) 10 | 11 | $Button = [Terminal.Gui.Button]::new() 12 | $Button.X = $X 13 | $Button.Y = $Y 14 | $Button.Text = $Text 15 | $Button.AutoSize = -not $DisableAutosize.IsPresent 16 | $Button 17 | } -------------------------------------------------------------------------------- /Public/New-TerminalCheckBox.ps1: -------------------------------------------------------------------------------- 1 | function New-TerminalCheckBox { 2 | [CmdletBinding()] 3 | param( 4 | [string[]] $Text, 5 | [int] $X, 6 | [int] $Y 7 | ) 8 | [Terminal.Gui.CheckBox]::new($X, $Y, $Text) 9 | } -------------------------------------------------------------------------------- /Public/New-TerminalRadioGroup.ps1: -------------------------------------------------------------------------------- 1 | function New-TerminalRadioGroup { 2 | [cmdletBinding()] 3 | param( 4 | [string[]] $Text, 5 | [int] $X, 6 | [int] $Y, 7 | [int] $Selected 8 | ) 9 | <# 10 | Terminal.Gui.RadioGroup new() 11 | Terminal.Gui.RadioGroup new(NStack.ustring[] radioLabels, int selected = 0) 12 | Terminal.Gui.RadioGroup new(Terminal.Gui.Rect rect, NStack.ustring[] radioLabels, int selected = 0) 13 | Terminal.Gui.RadioGroup new(int x, int y, NStack.ustring[] radioLabels, int selected = 0) 14 | #> 15 | [Terminal.Gui.RadioGroup]::new($X, $Y, $Text, $Selected) 16 | } -------------------------------------------------------------------------------- /Public/New-TerminalText.ps1: -------------------------------------------------------------------------------- 1 | function New-TerminalText { 2 | [cmdletBinding()] 3 | param( 4 | [int] $X, 5 | [int] $Y, 6 | [int] $Width, 7 | [Parameter(Mandatory)][string] $Text 8 | ) 9 | 10 | $TextField = [Terminal.Gui.TextField]::new() 11 | $TextField.X = $X 12 | $TextField.Y = $Y 13 | if ($Width) { 14 | $TextField.Width = $Width 15 | } 16 | if ($Text) { 17 | $TextField.Text = $Text 18 | } 19 | $TextField 20 | } -------------------------------------------------------------------------------- /Public/New-TerminalWindow.ps1: -------------------------------------------------------------------------------- 1 | function New-TerminalWindow { 2 | [cmdletBinding()] 3 | param( 4 | [scriptblock] $WindowContent, 5 | [string] $Title 6 | ) 7 | 8 | $Window = [Terminal.Gui.Window]::new() 9 | if ($Title) { 10 | $Window.Title = $Title 11 | } 12 | 13 | if ($WindowContent) { 14 | $Output = & $WindowContent 15 | 16 | foreach ($O in $Output) { 17 | $Window.Add($O) 18 | } 19 | } 20 | 21 | $Window.Add($btn) 22 | $Window 23 | } -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | 

2 | 3 | 4 | 5 | 6 |

7 | 8 |

9 | 10 | 11 | 12 | 13 |

14 | 15 |

16 | 17 | 18 | 19 |

20 | 21 | `ConsoleMonster` is a PowerShell module to build cool GUI applications using Spectre Console and Terminal GUI. -------------------------------------------------------------------------------- /Sources/ConsoleMonster.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32804.467 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleMonster", "ConsoleMonster\ConsoleMonster.csproj", "{EEF3BFAD-C8A5-474C-BA52-5C20E66EF0F9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {EEF3BFAD-C8A5-474C-BA52-5C20E66EF0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {EEF3BFAD-C8A5-474C-BA52-5C20E66EF0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {EEF3BFAD-C8A5-474C-BA52-5C20E66EF0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {EEF3BFAD-C8A5-474C-BA52-5C20E66EF0F9}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {F37BB785-3AB1-4498-8102-689C0E4C3924} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Sources/ConsoleMonster.sln.DotSettings.user: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /Sources/ConsoleMonster/ConsoleMonster.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Evotec 5 | Przemyslaw Klys 6 | 1.0.0 7 | net472;netstandard2.0;net6.0;net7.0 8 | ConsoleMonster 9 | 10 | (c) 2011 - 2022 Przemyslaw Klys @ Evotec. All rights reserved. 11 | 10.0 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | $(DefineConstants);FRAMEWORK 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Sources/ConsoleMonster/Initialize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleMonster { 8 | /// This is a dummy class that is used to initialize the module in PowerShell 9 | /// Doesnt do anything at all 10 | public class Initialize { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/ConsoleMonster/OnImportAndRemove.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Management.Automation; 4 | using System.Reflection; 5 | using System.Collections.Generic; 6 | 7 | public class OnModuleImportAndRemove : IModuleAssemblyInitializer, IModuleAssemblyCleanup { 8 | public void OnImport() { 9 | if (IsNetFramework()) { 10 | AppDomain.CurrentDomain.AssemblyResolve += MyResolveEventHandler; 11 | } 12 | } 13 | 14 | public void OnRemove(PSModuleInfo module) { 15 | if (IsNetFramework()) { 16 | AppDomain.CurrentDomain.AssemblyResolve -= MyResolveEventHandler; 17 | } 18 | } 19 | 20 | private static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args) { 21 | var libDirectory = Path.GetDirectoryName(typeof(OnModuleImportAndRemove).Assembly.Location); 22 | var directoriesToSearch = new List { libDirectory }; 23 | 24 | if (Directory.Exists(libDirectory)) { 25 | directoriesToSearch.AddRange(Directory.GetDirectories(libDirectory, "*", SearchOption.AllDirectories)); 26 | } 27 | 28 | var requestedAssemblyName = new AssemblyName(args.Name).Name + ".dll"; 29 | 30 | foreach (var directory in directoriesToSearch) { 31 | var assemblyPath = Path.Combine(directory, requestedAssemblyName); 32 | 33 | if (File.Exists(assemblyPath)) { 34 | try { 35 | return Assembly.LoadFrom(assemblyPath); 36 | } catch (Exception ex) { 37 | Console.WriteLine($"Failed to load assembly from {assemblyPath}: {ex.Message}"); 38 | } 39 | } 40 | } 41 | 42 | return null; 43 | } 44 | 45 | private bool IsNetFramework() { 46 | return System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); 47 | } 48 | private bool IsNetCore() { 49 | return System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); 50 | } 51 | private bool IsNet5OrHigher() { 52 | return System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 5", StringComparison.OrdinalIgnoreCase) || 53 | System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 6", StringComparison.OrdinalIgnoreCase) || 54 | System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 7", StringComparison.OrdinalIgnoreCase) || 55 | System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 8", StringComparison.OrdinalIgnoreCase) || 56 | System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 9", StringComparison.OrdinalIgnoreCase); 57 | } 58 | } --------------------------------------------------------------------------------