You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+124-8Lines changed: 124 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This PowerShell module contains a number of functions you might use to enhance y
6
6
7
7
## Current Release
8
8
9
-
You can get the current release from this repository or install this from the PowerShell Gallery:
9
+
You can get the current release from this repository or install this the PowerShell Gallery:
10
10
11
11
```powershell
12
12
Install-Module PSScriptTools
@@ -15,7 +15,7 @@ Install-Module PSScriptTools
15
15
or in PowerShell 7:
16
16
17
17
```powershell
18
-
Install-Module PSScriptTools -scope CurrentUser
18
+
Install-Module PSScriptTools [-scope CurrentUser]
19
19
```
20
20
21
21
Starting in v2.2.0, the module was restructured to better support Desktop and Core editions. But starting with version 2.13.0, the module design has reverted. All commands will be exported. Anything that is platform specific should be handled on a per command basis. It is assumed you will be running this module in Windows PowerShell 5.1 or PowerShell 7.
@@ -1103,7 +1103,9 @@ If you are running PowerShell 7 and specifying a file system path, you can displ
1103
1103
1104
1104

1105
1105
1106
-
I have long term plans to have a user-configurable color map for different item types.
1106
+
Beginning with v2.21.0, this command uses ANSI Color schemes from a json file.
1107
+
You can customize the file if you wish.
1108
+
See the [PSAnsiMap](#PSAnsiMap) section of this README.
1107
1109
1108
1110
This command has an alias of `pstree`.
1109
1111
@@ -1135,7 +1137,9 @@ C:\work\Alpha\
1135
1137
...
1136
1138
```
1137
1139
1138
-
Show a tree listing with files including a few properties. This example is using parameter and command aliases.
1140
+
This example is using parameter and command aliases.
1141
+
You can display a tree listing with files including user specified properties.
When using git you may create a number of branches.
1223
+
When using `git` you may create a number of branches.
1197
1224
Presumably you merge these branches into the main or master branch.
1198
1225
You can this command to remove all merged branches other than master and the current branch.
1199
1226
You must be in the root of your project to run this command.
@@ -1337,11 +1364,11 @@ If you run this command within VS Code and specify `-Passthru`, the resulting fi
1337
1364
1338
1365
### [Test-IsPSWindows](docs/Test-IsPSWindows.md)
1339
1366
1340
-
PowerShell Core introduced the `$IsWindows` variable. However it is not available on Windows PowerShell. Use this command to perform a simple test if the computer is either running Windows or using the Desktop PSEdition. The command returns True or False.
1367
+
PowerShell Core introduced the `$IsWindows` variable. However it is not available on Windows PowerShell. Use this command to perform a simple test if the computer is either running Windows or using the Desktop PSEdition. The command returns `True` or `False`.
1341
1368
1342
1369
### [Write-Detail](docs/Write-Detail.md)
1343
1370
1344
-
This command is designed to be used within your functions and scripts to make it easier to write a detailed message that you can use as verbose output. The assumption is that you are using an advanced function with a Begin, Process and End scriptblocks. You can create a detailed message to indicate what part of the code is being executed. The output can be configured to include a datetime stamp or just the time.
1371
+
This command is designed to be used within your functions and scripts to make it easier to write a detailed message that you can use as verbose output. The assumption is that you are using an advanced function with a `Begin`, `Process` and `End` scriptblocks. You can create a detailed message to indicate what part of the code is being executed. The output can be configured to include a datetime stamp or just the time.
1345
1372
1346
1373
```powershell
1347
1374
PS C:\> write-detail "Getting file information" -Prefix Process -Date
@@ -1389,6 +1416,95 @@ This will display the service status color-coded.
1389
1416
1390
1417

1391
1418
1419
+
### PSAnsiMap
1420
+
1421
+
I have done something similar for output from `Get-ChildItem`.
1422
+
The module includes json file that is exported as a global variable called `PSAnsiFileMap`.
1423
+
1424
+
```powershell
1425
+
PS C:\scripts\PSScriptTools> $PSAnsiFileMap
1426
+
1427
+
Description Pattern Ansi
1428
+
----------- ------- ----
1429
+
PowerShell \.ps(d|m)?1$
1430
+
Text \.(txt)|(md)|(log)$
1431
+
DataFile \.(json)|(xml)|(csv)$
1432
+
Executable \.(exe)|(bat)|(cmd)|(sh)$
1433
+
Graphics \.(jpg)|(png)|(gif)|(bmp)|(jpeg)$
1434
+
Media \.(mp3)|(m4v)|(wav)|(au)|(flac)|(mp4)$
1435
+
Archive \.(zip)|(rar)|(tar)|(gzip)$
1436
+
TopContainer
1437
+
ChildContainer
1438
+
```
1439
+
1440
+
The map includes ANSI settings for different file types.
1441
+
You won't see the ANSI value in the output.
1442
+
The module will add a custom table view called `ansi` which you can use to display file results colorized in PowerShell 7.
1443
+
1444
+

1445
+
1446
+
The mapping file is user customizable.
1447
+
Copy the `psansifilemap.json` file from the module's root directory to $HOME.
1448
+
When you import this module, if the file is found, it will be imported and used as `psansifilemap`, otherwise the module's file will be used.
The Pattern value should be a regular expression pattern to match on the filename.
1504
+
Don't forget you will need to escape characters for the json format.
1505
+
The Ansi value will be an ANSI escape sequence.
1506
+
You can use `\u001b` for the \``e` character.
1507
+
1392
1508
## Related Modules
1393
1509
1394
1510
If you find this module useful, you might also want to look at my tools for [creating and managing custom type extensions](https://github.com/jdhitsolutions/PSTypeExtensionTools), [managing scheduled jobs](https://github.com/jdhitsolutions/ScheduledJobTools) and [running remote commands outside of PowerShell Remoting](https://github.com/jdhitsolutions/PSRemoteOperations)
@@ -1397,4 +1513,4 @@ If you find this module useful, you might also want to look at my tools for [cre
1397
1513
1398
1514
Where possible these commands have been tested with PowerShell 7, but not every platform. If you encounter problems, have suggestions or other feedback, please post an issue. It is assumed you will __not__ be running this commands on any edition of PowerShell Core or any beta releases of PowerShell 7.
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).
91
+
92
+
## INPUTS
93
+
94
+
### [System.String]
95
+
96
+
## OUTPUTS
97
+
98
+
### gitSize
99
+
100
+
## NOTES
101
+
102
+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
103
+
104
+
This is a variation of code posted at https://gist.github.com/jdhitsolutions/cbdc7118f24ba551a0bb325664415649
You can use this command to modify the PowerShell console's foreground and/or background color. Note that if you are running the PSReadline module, that module has commands, like Set-PSReadLineOption, that you can use to modify your console.
23
+
You can use this command to modify the PowerShell console's foreground and/or background color. Note that if you are running the PSReadline module, that module has commands, like Set-PSReadLineOption, that you can use to modify your console. This command is intended for use in a traditional PowerShell console. It will not work in consoles that are part of the PowerShell ISE or Visual Studio Code.
Use this command to modify the text displayed in the title bar of your PowerShell console window.
23
+
This command is intended for use in a traditional PowerShell console. It will not work in consoles that are part of the PowerShell ISE or Visual Studio Code. It should work in a PowerShell session running in Windows Terminal.
Copy file name to clipboardExpand all lines: docs/Show-Tree.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Shows the specified path as a graphical tree in the console. This is intended as
33
33
34
34
By default, the output will only show directory or equivalent structures. But you can opt to include items well as item details by using the ShowProperty parameter. Specify a comma separated list of properties or use * to view them all.
35
35
36
-
It should work cross-platform. If you are running PowerShell 7, there is a dynamic parameter, -InColor, that will write ANSI-colored output to the pipeline. The color scheme is designed for the file system.
36
+
It should work cross-platform. If you are running PowerShell 7, there is a dynamic parameter, -InColor, that will write ANSI-colored output to the pipeline. The color scheme is designed for the file system. This parameter has an alias of -ansi.
37
37
38
38
Note: This is an update to an older function in my library. I seem to recall I found the original code somewhere online, perhaps from someone like Lee Holmes. Sadly, I neglected to record the source.
39
39
@@ -152,7 +152,7 @@ C:\work\Alpha\
152
152
...
153
153
```
154
154
155
-
Show a tree listing with files including a few properties. This example is using parameter and command aliases.
155
+
Show a tree listing with files including a few user specified properties. This example is using parameter and command aliases.
0 commit comments