Skip to content

Commit 92ade42

Browse files
v2.43.0
1 parent de6891a commit 92ade42

11 files changed

+33
-164
lines changed

PSScriptTools.psd1

-156 Bytes
Binary file not shown.

PSScriptTools.psm1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@ $global:PSSamplePath = Join-Path -Path $PSScriptroot -ChildPath Samples
8484

8585
Write-Verbose "Add ToDo options to the ISE or VS Code"
8686
if ($psEditor) {
87-
#This may not be working in newer versions of the PowerShell extension under PowerShell 7
8887
Write-Verbose "Defining VSCode additions"
8988
$sb = {
90-
Param(
91-
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context
92-
)
89+
Param($context = $psEditor.GetEditorContext() )
9390
$prompt = "What do you need to do?"
9491
$title = "To Do"
9592
$item = Invoke-InputBox -Title $title -Prompt $prompt
@@ -153,7 +150,6 @@ elseif ($psise) {
153150
Param()
154151

155152
if ($host.name -match "ISE") {
156-
157153
$path = Split-Path -Path $psISE.CurrentFile.FullPath
158154
Set-Location -Path $path
159155
Clear-Host

PSScriptToolsManual.pdf

-56.2 KB
Binary file not shown.

README.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,29 +1481,6 @@ These functions were first described at [https://jdhitsolutions.com/blog/powersh
14811481

14821482
If you are running in a PowerShell console session, and the Elevated value is True, it will be displayed in color. The Memory and Runtime values are calculated ScriptProperties.
14831483

1484-
### [ConvertTo-ASCIIArt](docs/ConvertTo-ASCIIArt.md)
1485-
1486-
`ConvertTo-ASCIIArt` can be used to transform a string of text into ASCII art. It utilizes the web service at https://artii.herokuapp.com which allows you to transform text. You might use this to create headers for your scripts or PowerShell profile.
1487-
1488-
![ConvertTo-ASCIIArt](images/cart.png)
1489-
1490-
I used this command to convert a string that I'm using with `Get-PSScriptTools` to display a "splash" header.
1491-
1492-
```powershell
1493-
$h = @"
1494-
___ ___ ___ _ _ _____ _
1495-
| _ \ __/ __|__ _ _(_)_ __| |__ _|__ ___| |___
1496-
| _\__ \__ \ _| '_| | '_ \ _|| |/ _ \ _ \ (_-<
1497-
|_| |___/___\__|_| |_| .__/\__||_|\___\___/_/__/
1498-
|_|
1499-
"@
1500-
"$([char]0x1b)[1;38;5;177m$h$([char]0x1b)[0m" | Write-Host
1501-
```
1502-
1503-
![PSScriptTools Splash](images/psscripttools-splash.png)
1504-
1505-
Expect a period of trial and error to find a good font that works with your text. The shorter your text, the better.
1506-
15071484
### [Out-Copy](docs/Out-Copy.md)
15081485

15091486
This command is intended for writers and those who need to document with PowerShell. You can pipe any command to this function, and you will get the regular output in your PowerShell session. Simultaneously, a copy of the output will be sent to the Windows clipboard. The copied output will include a prompt constructed from the current location unless you use the CommandOnly parameter.
File renamed without changes.

functions/ConvertTo-ASCIIArt.ps1 renamed to archive/ConvertTo-ASCIIArt.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
#Removed 4/4/2022 as the online resources no longer exist
23
<#
34
font list at https://artii.herokuapp.com/fonts_list
45
font names are case-sensitive

archive/readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Files that are no longer part of the module

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
This file contains the most recent change history for the PSScriptTools module.
44

5+
## v2.43.0
6+
7+
+ Fixed VSCode snippets to run in a PowerShell 7 integrated console. [Issue #124](https://github.com/jdhitsolutions/PSScriptTools/issues/124)
8+
+ Updated `Show-AnsiSequence` to fix a display bug that was dropping values. [Issue #125](https://github.com/jdhitsolutions/PSScriptTools/issues/125)
9+
+ Removed `ConvertTo-ASCIIArt` as the online resource no longer appears to exist. [Issue #127](https://github.com/jdhitsolutions/PSScriptTools/issues/127)
10+
+ Updated missing online help links.
11+
+ Updated `Get-FoldersizeInfo` to better handle null values. [Issue #129](https://github.com/jdhitsolutions/PSScriptTools/issues/129)
12+
+ Added new sample script `today.ps1`.
13+
+ Help updates.
14+
+ Updated `README.md`.
15+
516
## v2.42.0
617

718
+ Updated module manifest to load required .NET assembly for `Convert-HTMLtoAnsi`. [Issue #124](https://github.com/jdhitsolutions/PSScriptTools/issues/124)

en-us/PSScriptTools-help.xml

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,127 +1936,6 @@ Monday, March 4, 2020 1:00:00 PM</dev:code>
19361936
</maml:navigationLink>
19371937
</command:relatedLinks>
19381938
</command:command>
1939-
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
1940-
<command:details>
1941-
<command:name>ConvertTo-ASCIIArt</command:name>
1942-
<command:verb>ConvertTo</command:verb>
1943-
<command:noun>ASCIIArt</command:noun>
1944-
<maml:description>
1945-
<maml:para>Convert text to ASCII art.</maml:para>
1946-
</maml:description>
1947-
</command:details>
1948-
<maml:description>
1949-
<maml:para>This command can be used to transform a string of text into ASCII art. ConvertTo-ASCIIArt utilizes the web service at https://artii.herokuapp.com which allows you to transform text. You might use this to create headers for your scripts or PowerShell profile.</maml:para>
1950-
<maml:para>Expect a period of trial and error to find a good font that works with your text. The shorter your text, the better.</maml:para>
1951-
</maml:description>
1952-
<command:syntax>
1953-
<command:syntaxItem>
1954-
<maml:name>ConvertTo-ASCIIArt</maml:name>
1955-
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none">
1956-
<maml:name>Text</maml:name>
1957-
<maml:description>
1958-
<maml:para>Enter a short string of text to convert.</maml:para>
1959-
</maml:description>
1960-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
1961-
<dev:type>
1962-
<maml:name>String</maml:name>
1963-
<maml:uri />
1964-
</dev:type>
1965-
<dev:defaultValue>None</dev:defaultValue>
1966-
</command:parameter>
1967-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
1968-
<maml:name>Font</maml:name>
1969-
<maml:description>
1970-
<maml:para>Specify a font from https://artii.herokuapp.com/fonts_list. Font names are case-sensitive. You can use tab-completion to cycle through the list.</maml:para>
1971-
</maml:description>
1972-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
1973-
<dev:type>
1974-
<maml:name>String</maml:name>
1975-
<maml:uri />
1976-
</dev:type>
1977-
<dev:defaultValue>big</dev:defaultValue>
1978-
</command:parameter>
1979-
</command:syntaxItem>
1980-
</command:syntax>
1981-
<command:parameters>
1982-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
1983-
<maml:name>Font</maml:name>
1984-
<maml:description>
1985-
<maml:para>Specify a font from https://artii.herokuapp.com/fonts_list. Font names are case-sensitive. You can use tab-completion to cycle through the list.</maml:para>
1986-
</maml:description>
1987-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
1988-
<dev:type>
1989-
<maml:name>String</maml:name>
1990-
<maml:uri />
1991-
</dev:type>
1992-
<dev:defaultValue>big</dev:defaultValue>
1993-
</command:parameter>
1994-
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none">
1995-
<maml:name>Text</maml:name>
1996-
<maml:description>
1997-
<maml:para>Enter a short string of text to convert.</maml:para>
1998-
</maml:description>
1999-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
2000-
<dev:type>
2001-
<maml:name>String</maml:name>
2002-
<maml:uri />
2003-
</dev:type>
2004-
<dev:defaultValue>None</dev:defaultValue>
2005-
</command:parameter>
2006-
</command:parameters>
2007-
<command:inputTypes>
2008-
<command:inputType>
2009-
<dev:type>
2010-
<maml:name>System.String</maml:name>
2011-
</dev:type>
2012-
<maml:description>
2013-
<maml:para></maml:para>
2014-
</maml:description>
2015-
</command:inputType>
2016-
</command:inputTypes>
2017-
<command:returnValues>
2018-
<command:returnValue>
2019-
<dev:type>
2020-
<maml:name>System.String</maml:name>
2021-
</dev:type>
2022-
<maml:description>
2023-
<maml:para></maml:para>
2024-
</maml:description>
2025-
</command:returnValue>
2026-
</command:returnValues>
2027-
<maml:alertSet>
2028-
<maml:alert>
2029-
<maml:para>This command has an alias of cart.</maml:para>
2030-
<maml:para>Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/</maml:para>
2031-
</maml:alert>
2032-
</maml:alertSet>
2033-
<command:examples>
2034-
<command:example>
2035-
<maml:title>-------------------------- Example 1 --------------------------</maml:title>
2036-
<dev:code>PS C:\&gt; ConvertTo-ASCIIArt -text PScriptTools -Font cybermedium
2037-
___ ____ ____ ____ _ ___ ___ ___ ____ ____ _ ____
2038-
|__] [__ | |__/ | |__] | | | | | | | [__
2039-
| ___] |___ | \ | | | | |__| |__| |___ ___]</dev:code>
2040-
<dev:remarks>
2041-
<maml:para>Convert the string 'PSScriptTools' with the cybermedium font. The font parameter supports auto-completion so you can tab-complete to see all possible options.</maml:para>
2042-
</dev:remarks>
2043-
</command:example>
2044-
<command:example>
2045-
<maml:title>-------------------------- Example 2 --------------------------</maml:title>
2046-
<dev:code>PS C:\&gt; ConvertTo-ASCIIArt -Text $env:COMPUTERNAME -Font ogre |
2047-
Out-File c:\scripts\computername-art.txt</dev:code>
2048-
<dev:remarks>
2049-
<maml:para>Convert the computer name to ASCII art and save the results to a text file. Later you can use Get-Content to display the "artistic" version of the computer name.</maml:para>
2050-
</dev:remarks>
2051-
</command:example>
2052-
</command:examples>
2053-
<command:relatedLinks>
2054-
<maml:navigationLink>
2055-
<maml:linkText>Online Version:</maml:linkText>
2056-
<maml:uri>https://bit.ly/32DadcG</maml:uri>
2057-
</maml:navigationLink>
2058-
</command:relatedLinks>
2059-
</command:command>
20601939
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
20611940
<command:details>
20621941
<command:name>ConvertTo-Hashtable</command:name>

functions/Get-FolderSizeInfo.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ Function Get-FolderSizeInfo {
4343
}
4444

4545
$data = $($d.GetFiles("*", $opt))
46-
if ($data.count -gt 1) {
46+
if ($data -AND $data.count -gt 1) {
4747
$files.AddRange($data)
4848
}
49-
elseif ($data.count -eq 1) {
49+
elseif ($data -AND $data.count -eq 1) {
5050
[void]($files.Add($data))
5151
}
5252

53-
} #if newer that Windows PowerShell 5.1
53+
} #if newer than Windows PowerShell 5.1
5454
else {
5555
Write-Verbose "Using legacy code"
5656
#need to account for errors when accessing folders without permissions
@@ -94,10 +94,10 @@ Function Get-FolderSizeInfo {
9494
$data = $($d.GetFiles()).Where({$_.attributes -notmatch "hidden"})
9595
}
9696

97-
if ($data.count -gt 1) {
97+
if ($data -AND $data.count -gt 1) {
9898
$files.AddRange($data)
9999
}
100-
elseif ($data.count -eq 1) {
100+
elseif ($data -AND $data.count -eq 1) {
101101
[void]($files.Add($data))
102102
}
103103

@@ -110,6 +110,7 @@ Function Get-FolderSizeInfo {
110110
$all = _enumdir @eparam
111111

112112
#get the files in each subfolder
113+
if ($all) {
113114
Write-Verbose "Getting files from $($all.count) subfolders"
114115

115116
($all).Foreach( {
@@ -122,10 +123,10 @@ Function Get-FolderSizeInfo {
122123
else {
123124
$data = (([System.IO.DirectoryInfo]"$($_.fullname)").GetFiles()).where({$_.Attributes -notmatch "Hidden"})
124125
}
125-
if ($data.count -gt 1) {
126+
if ($data -AND $data.count -gt 1) {
126127
$files.AddRange($data)
127128
}
128-
elseif ($data.count -eq 1) {
129+
elseif ($data -AND $data.count -eq 1) {
129130
[void]($files.Add($data))
130131
}
131132
}
@@ -135,6 +136,7 @@ Function Get-FolderSizeInfo {
135136
Clear-variable data
136137
}
137138
})
139+
} #if $all
138140
} #else 5.1
139141

140142
If ($files.count -gt 0) {

functions/Get-PSScriptTools.ps1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,29 @@ Function Get-PSScriptTools {
2020
Write-Verbose "Using these bound parameters"
2121
$PSBoundParameters | Out-String | Write-Verbose
2222

23-
<#
23+
<#
2424
$h = @"
25-
___ ___ ___ _ _ _____ _
25+
___ ___ ___ _ _ _____ _
2626
| _ \ __/ __|__ _ _(_)_ __| |__ _|__ ___| |___
2727
| _\__ \__ \ _| '_| | '_ \ _|| |/ _ \ _ \ (_-<
2828
|_| |___/___\__|_| |_| .__/\__||_|\___\___/_/__/
2929
|_|
3030
3131
"@
32-
#>
32+
#>
33+
34+
#Convertto-ASCIIArt has been removed from the module 4/4/2022
3335
#ignore and suppress errors to create the ASCII art since this is optional and decorative only
34-
$h = ConvertTo-ASCIIArt $thisModule -font small -ErrorAction SilentlyContinue
35-
$h+= "`n"
36-
$h += ConvertTo-ASCIIArt $thisVersion -Font small -ErrorAction SilentlyContinue
36+
#$h = ConvertTo-ASCIIArt $thisModule -font small -ErrorAction SilentlyContinue
37+
# $h+= "`n"
38+
#$h += ConvertTo-ASCIIArt $thisVersion -Font small -ErrorAction SilentlyContinue
3739

38-
if ($host.name -match "console") {
40+
<# if ($host.name -match "console") {
3941
"$([char]0x1b)[1;38;5;177m$h$([char]0x1b)[0m" | Write-Host
4042
}
4143
else {
4244
Write-Host $h
43-
}
45+
} #>
4446
#Write-Host $h -ForegroundColor Yellow
4547

4648
Write-Verbose "Getting exported functions from $thisModule"

0 commit comments

Comments
 (0)