Skip to content

Commit cc8b39a

Browse files
2.35.0
1 parent d653831 commit cc8b39a

25 files changed

+1152
-231
lines changed

PSScriptTools.psd1

342 Bytes
Binary file not shown.

PSScriptToolsManual.pdf

17.7 KB
Binary file not shown.

README.md

Lines changed: 199 additions & 160 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
# Change Log for PSScriptTools
22

3-
This is the most recent change history for this module.
3+
This file contains the most recent change history for the PSScriptTools module.
4+
5+
## v2.35.0
6+
7+
+ Added `ConvertTo-TitleCase` command with aliases of `totc` and `title`.
8+
+ Added `New-FunctionItem` command with an alias of `nfi` to create functions on-the-fly.
9+
+ Added `Show-FunctionItem` command with an alias of `sfi` to display a function.
10+
+ Modified format files to test the console when using ANSI formatting. ([Issue #102](https://github.com/jdhitsolutions/PSScriptTools/issues/102))
11+
+ Modified ANSI functions to display a warning when run in the PowerShell ISE and exit.
12+
+ Updated `Get-PSScriptTools` to not use ANSI in the header when running in a non-console host.
13+
+ Updated `Get-CommandSyntax` to not use ANSI formatting when running in a non-console host.
14+
+ Updated `README.md`.
415

516
## v2.34.1
617

7-
+ Updated `license.txt` with new year.
18+
+ Updated `license.txt` with the new year.
819
+ Added missing online help links.
9-
+ Fixed bug in `Get-ParameterInfo` that failed to display dynamic parameters when using a command alias. (Issue #101)
20+
+ Fixed bug in `Get-ParameterInfo` that failed to display dynamic parameters when using a command alias. ([Issue #101](https://github.com/jdhitsolutions/PSScriptTools/issues/101))
1021
+ Modified format file for `PSParameterInfo` to display `Mandatory` and `IsDynamic` values in color when the value is `$True`.
1122

1223
## v2.34.0
1324

14-
+ Fixed typo bug in `Get-PSScriptTools` that was failing to get command aliases. (Issue #99)
15-
+ Modified `Get-PSScriptTools` to improve performance. Assuming that all exported functions use standard verbs.
25+
+ Fixed typo bug in `Get-PSScriptTools` that was failing to get command aliases. ([Issue #99](https://github.com/jdhitsolutions/PSScriptTools/issues/99))
26+
+ Modified `Get-PSScriptTools` to improve performance. Assuming that all exported functions are using standard verbs.
1627
+ Added `Get-PSAnsiFileMap`.
1728
+ Added `Set-PSAnsiFileMapEntry`.
1829
+ Added `Remove-PSAnsiFileMapEntry`.
@@ -40,7 +51,7 @@ This is the most recent change history for this module.
4051
+ Added more Verbose messages to `Get-PSScriptTools`.
4152
+ Code cleanup in `SelectFunctions.ps1`.
4253
+ Modified `Get-PSScriptTools` to let you specify a verb. Updated command help.
43-
+ Modified `ConvertTo-Markdown` to handle properties with line returns when formatting as a table. (Issue #97)
54+
+ Modified `ConvertTo-Markdown` to handle properties with line returns when formatting as a table. (I[Issue #97](https://github.com/jdhitsolutions/PSScriptTools/issues/97))
4455
+ Code cleanup in sample script files.
4556
+ Added sample file `CounterMarkdown.ps1`.
4657
+ Updated `README.md`.

docs/ConvertTo-TitleCase.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# ConvertTo-TitleCase
9+
10+
## SYNOPSIS
11+
12+
Convert a string to title case.
13+
14+
## SYNTAX
15+
16+
```yaml
17+
ConvertTo-TitleCase [-Text] <String> [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This command is a simple function to convert a string to title or proper case.
23+
24+
## EXAMPLES
25+
26+
### Example 1
27+
28+
```powershell
29+
PS C:\> ConvertTo-TitleCase "working summary"
30+
31+
Working Summary
32+
```
33+
34+
### Example 2
35+
36+
```powershell
37+
PS C:\> "art deco","jack frost","al fresco" | ConvertTo-TitleCase
38+
39+
Art Deco
40+
Jack Frost
41+
Al Fresco
42+
```
43+
44+
## PARAMETERS
45+
46+
### -Text
47+
48+
Text to convert to title case.
49+
50+
```yaml
51+
Type: String
52+
Parameter Sets: (All)
53+
Aliases:
54+
55+
Required: True
56+
Position: 0
57+
Default value: None
58+
Accept pipeline input: True (ByValue)
59+
Accept wildcard characters: False
60+
```
61+
62+
### CommonParameters
63+
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+
### System.String
69+
70+
## OUTPUTS
71+
72+
### System.String
73+
74+
## NOTES
75+
76+
## RELATED LINKS

docs/New-FunctionItem.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# New-FunctionItem
9+
10+
## SYNOPSIS
11+
12+
Create a function item from the console
13+
14+
## SYNTAX
15+
16+
```powershell
17+
New-FunctionItem [-Name] <String> [-Scriptblock] <ScriptBlock>
18+
[[-Description] <String>] [-Passthru] [-WhatIf] [-Confirm]
19+
[<CommonParameters>]
20+
```
21+
22+
## DESCRIPTION
23+
24+
You can use this function to create a quick function definition directly from the console. This command does not write anything to the pipeline unless you use -Passthru.
25+
26+
## EXAMPLES
27+
28+
### EXAMPLE 1
29+
30+
```powershell
31+
PS C:\> New-FunctionItem -name ToTitle -scriptblock {param([string]$Text)
32+
(Get-Culture).TextInfo.ToTitleCase($text.toLower())} -passthru
33+
34+
CommandType Name Version Source
35+
----------- ---- ------- ------
36+
Function ToTitle
37+
```
38+
39+
### EXAMPLE 2
40+
41+
```powershell
42+
PS C:\> {Get-Date -format g | Set-Clipboard} | New-FunctionItem -name Copy-Date
43+
```
44+
45+
## PARAMETERS
46+
47+
### -Name
48+
49+
What is the name of your function?
50+
51+
```yaml
52+
Type: String
53+
Parameter Sets: (All)
54+
Aliases:
55+
56+
Required: True
57+
Position: 1
58+
Default value: None
59+
Accept pipeline input: False
60+
Accept wildcard characters: False
61+
```
62+
63+
### -Scriptblock
64+
65+
What is your function's scriptblock?
66+
67+
```yaml
68+
Type: ScriptBlock
69+
Parameter Sets: (All)
70+
Aliases:
71+
72+
Required: True
73+
Position: 2
74+
Default value: None
75+
Accept pipeline input: True (ByValue)
76+
Accept wildcard characters: False
77+
```
78+
79+
### -Description
80+
81+
You can specify an optional description. This only lasts for as long as your function is loaded.
82+
83+
```yaml
84+
Type: String
85+
Parameter Sets: (All)
86+
Aliases:
87+
88+
Required: False
89+
Position: 3
90+
Default value: None
91+
Accept pipeline input: False
92+
Accept wildcard characters: False
93+
```
94+
95+
### -Passthru
96+
97+
Show the newly created function.
98+
99+
```yaml
100+
Type: SwitchParameter
101+
Parameter Sets: (All)
102+
Aliases:
103+
104+
Required: False
105+
Position: Named
106+
Default value: False
107+
Accept pipeline input: False
108+
Accept wildcard characters: False
109+
```
110+
111+
### -WhatIf
112+
113+
Shows what would happen if the cmdlet runs. The cmdlet is not run.
114+
115+
```yaml
116+
Type: SwitchParameter
117+
Parameter Sets: (All)
118+
Aliases: wi
119+
120+
Required: False
121+
Position: Named
122+
Default value: None
123+
Accept pipeline input: False
124+
Accept wildcard characters: False
125+
```
126+
127+
### -Confirm
128+
129+
Prompts you for confirmation before running the cmdlet.
130+
131+
```yaml
132+
Type: SwitchParameter
133+
Parameter Sets: (All)
134+
Aliases: cf
135+
136+
Required: False
137+
Position: Named
138+
Default value: None
139+
Accept pipeline input: False
140+
Accept wildcard characters: False
141+
```
142+
143+
### CommonParameters
144+
145+
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).
146+
147+
## INPUTS
148+
149+
### Scriptbloclk
150+
151+
## OUTPUTS
152+
153+
### None
154+
155+
### System.Management.Automation.FunctionInfo
156+
157+
## NOTES
158+
159+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
160+
161+
## RELATED LINKS
162+
163+
[Show-FunctionItem](Show-FunctionItem.md)

docs/Set-ConsoleColor.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ Specify a background console color
4242
Type: ConsoleColor
4343
Parameter Sets: (All)
4444
Aliases: bg
45-
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta,
46-
DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
45+
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta,DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
4746

4847
Required: False
4948
Position: 1
@@ -92,8 +91,7 @@ Specify a foreground console color.
9291
Type: ConsoleColor
9392
Parameter Sets: (All)
9493
Aliases: fg
95-
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta,
96-
DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
94+
Accepted values: Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta,DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
9795

9896
Required: False
9997
Position: 0

docs/Show-FunctionItem.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Show-FunctionItem
9+
10+
## SYNOPSIS
11+
12+
Show a function in written form.
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Show-FunctionItem [-Name] <String> [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This command will display a loaded function as it might look in a code editor. You could use this command to export a loaded function to a file.
23+
24+
## EXAMPLES
25+
26+
### EXAMPLE 1
27+
28+
```powershell
29+
PS C:\> Show-FunctionItem prompt
30+
31+
Function Prompt {
32+
33+
"PS $($executionContext.SessionState.Path.CurrentLocation)$('\>' * ($nestedPromptLevel + 1)) ";
34+
# .Link
35+
# https://go.microsoft.com/fwlink/?LinkID=225750
36+
# .ExternalHelp System.Management.Automation.dll-help.xml
37+
38+
} #close prompt
39+
```
40+
41+
### EXAMPLE 2
42+
43+
```powershell
44+
PS C:\> Show-FunctionItem Copy-Zip | Out-File c:\Scripts\copy-zip.ps1
45+
```
46+
47+
Here's how you can save or export a function you might have created on-the-fly to a file.
48+
49+
## PARAMETERS
50+
51+
### -Name
52+
53+
What is the name of your function?
54+
55+
```yaml
56+
Type: String
57+
Parameter Sets: (All)
58+
Aliases:
59+
60+
Required: True
61+
Position: 1
62+
Default value: None
63+
Accept pipeline input: False
64+
Accept wildcard characters: False
65+
```
66+
67+
### CommonParameters
68+
69+
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).
70+
71+
## INPUTS
72+
73+
## OUTPUTS
74+
75+
### String
76+
77+
## NOTES
78+
79+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
80+
81+
## RELATED LINKS
82+
83+
[New-FunctionItem](New-FunctionItem.md)

0 commit comments

Comments
 (0)