Skip to content

Commit 651cdc4

Browse files
verbose output revisions
1 parent b52d9c5 commit 651cdc4

19 files changed

Lines changed: 276 additions & 169 deletions

License.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022-2023 JDH Information Technology Solutions, Inc.
3+
Copyright (c) 2022-2024 JDH Information Technology Solutions, Inc.
44

55

66
Permission is hereby granted, free of charge, to any person obtaining a copy

PSProjectStatus.psd1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
@{
44
RootModule = 'PSProjectStatus.psm1'
5-
ModuleVersion = '0.12.0'
5+
ModuleVersion = '0.13.0'
66
CompatiblePSEditions = 'Desktop', 'Core'
77
GUID = 'ec249544-dc4e-4e24-aae8-4281ec84f54d'
88
Author = 'Jeff Hicks'
99
CompanyName = 'JDH Information Technology Solutions, Inc.'
10-
Copyright = '(c) 2022-2023 JDH Information Technology Solutions, Inc. All rights reserved.'
10+
Copyright = '(c) 2022-2024 JDH Information Technology Solutions, Inc. All rights reserved.'
1111
Description = 'A set of PowerShell tools for tracking module development status. The module uses a JSON file to create a custom object with information about your module. You can use this internally to track the status of your module including a simple to-do tracker. This module was first described at https://jdhitsolutions.com/blog/powershell/8960/introducing-psprojectstatus/'
1212
PowerShellVersion = '5.1'
1313
TypesToProcess = @('types\psprojectstatus.types.ps1xml')
@@ -16,9 +16,10 @@
1616
'Get-PSProjectStatus', 'New-PSProjectStatus',
1717
'Set-PSProjectStatus', 'Get-PSProjectGitStatus',
1818
'Get-PSProjectReport', 'Get-PSProjectTask',
19-
'New-PSProjectTask', 'Remove-PSProjectTask'
19+
'New-PSProjectTask', 'Remove-PSProjectTask',
20+
'Update-PSProjectStatus'
2021
)
21-
AliasesToExport = @('gpstat', 'npstat', 'spstat', 'gitstat', 'Update-PSProjectStatus')
22+
AliasesToExport = @('gpstat', 'npstat', 'spstat', 'gitstat')
2223
PrivateData = @{
2324
PSData = @{
2425
Tags = @('modules', 'scripting', 'project-management', 'project', 'psmodule', 'to-do')

PSProjectStatus.psm1

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#region load string data
12
# used for culture debugging
2-
# write-host "Importing with culture $(Get-Culture)"
3+
# write-host "Importing with culture $(Get-Culture)" -ForeGroundColor yellow
34

4-
if ((Get-Culture).Name -match "\w+") {
5+
if ((Get-Culture).Name -match '\w+') {
56
#write-host "Using culture $(Get-Culture)" -ForegroundColor yellow
67
Import-LocalizedData -BindingVariable strings
78
}
@@ -11,12 +12,14 @@ else {
1112
Import-LocalizedData -BindingVariable strings -FileName psprojectstatus.psd1 -BaseDirectory $PSScriptRoot/en-us
1213
}
1314

15+
#endregion
1416

15-
#dot source functions
17+
#region dot source functions
1618
Get-ChildItem $PSScriptRoot\functions\*.ps1 -Recurse |
1719
ForEach-Object {
1820
. $_.FullName
1921
}
22+
#endregion
2023

2124

2225
#region class definitions
@@ -75,12 +78,12 @@ Class PSProject {
7578
$json = Join-Path -Path $this.path -ChildPath psproject.json
7679
#convert the ProjectVersion to a string in the JSON file
7780
#convert the LastUpdate to a formatted date string
78-
$this | Select-Object @{Name = '$schema'; Expression = { 'https://raw.githubusercontent.com/jdhitsolutions/PSProjectStatus/main/psproject.schema.json' } },
81+
$this | Select-Object -Property @{Name = '$schema'; Expression = { 'https://raw.githubusercontent.com/jdhitsolutions/PSProjectStatus/main/psproject.schema.json' } },
7982
Name, Path,
8083
@{Name = 'LastUpdate'; Expression = { '{0:o}' -f $_.LastUpdate } },
8184
@{Name = 'Status'; Expression = { $_.status.toString() } },
8285
@{Name = 'ProjectVersion'; Expression = { $_.ProjectVersion.toString() } },
83-
UpdateUser,Computername,RemoteRepository,Tasks,GitBranch,Tags,Comment |
86+
UpdateUser, Computername, RemoteRepository, Tasks, GitBranch, Tags, Comment |
8487
ConvertTo-Json | Out-File -FilePath $json -Encoding utf8
8588
}
8689
[void]RefreshProjectVersion() {
@@ -283,12 +286,32 @@ if ($host.name -match 'ISE') {
283286

284287
#endregion
285288

289+
#region definitions and exports
290+
286291
#path to the JSON schema file
287292
$jsonSchema = 'https://raw.githubusercontent.com/jdhitsolutions/PSProjectStatus/main/psproject.schema.json'
288293

289294
# for testing
290295
# $jsonSchema = "file:///c:/scripts/psprojectstatus/psproject.schema.json"
291296

297+
#a hash table to store ANSI escape sequences for different commands used in verbose output with the
298+
#private _verbose helper function
299+
$PSProjectANSI = @{
300+
'Get-PSProjectGitStatus' = '[1;38;5;51m'
301+
'Get-PSProjectReport' = '[1;38;5;111m'
302+
'Get-PSProjectStatus' = '[1;96m'
303+
'Get-PSProjectTask' = '[1;38;5;10m'
304+
'New-PSProjectStatus' = '[1;38;5;208m'
305+
'New-PSProjectTask' = '[1;38;5;159m'
306+
'Remove-PSProjectTask' = '[1;38;5;195m'
307+
'Set-PSProjectStatus' = '[1;38;5;214m'
308+
Default = '[1;38;5;51m'
309+
}
310+
Set-Variable -Name PSProjectANSI -Description "a hash table to store ANSI escape sequences for different commands used in verbose output. You can modify settings using ANSI sequences or `$PSStyle"
311+
292312
#Export the module version to a global variable that will be used in Verbose messages
293-
New-Variable -Name PSProjectStatusModule -Value "0.12.0" -Description "The PSProjectStatus module version used in verbose messaging."
294-
Export-ModuleMember -Variable PSProjectStatusModule -Alias 'Update-PSProjectStatus','gitstat','gpstat', 'npstat', 'spstat'
313+
New-Variable -Name PSProjectStatusModule -Value '0.13.0' -Description 'The PSProjectStatus module version used in verbose messaging.'
314+
315+
Export-ModuleMember -Variable PSProjectStatusModule, PSProjectANSI -Alias 'Update-PSProjectStatus', 'gitstat', 'gpstat', 'npstat', 'spstat'
316+
317+
#endregion

README.md

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ PS C:\scripts\PSHelpDesk> Set-PSProjectStatus -LastUpdate (Get-Date) -Status Dev
279279
280280
Name: PSHelpDesk [C:\Scripts\PSHelpDesk]
281281
282-
LastUpdate Status Tasks GitBranch Age
283-
---------- ------ ----- --------- ---
284-
3/15/2023 5:53:54 PM Development {update help, add... dev 00.00:00
282+
LastUpdate Status Tasks GitBranch Age
283+
---------- ------ ----- --------- ---
284+
3/15/2023 5:53:54 PM Development {update help, add... dev 00.00:00
285285
```
286286

287287
When defining tasks, use `-Concatenate` to append the tasks. Otherwise, tasks will be overwritten with the new value.
@@ -519,9 +519,9 @@ Status Property PSProjectStatus Status {get;set;}
519519
Tags Property string[] Tags {get;set;}
520520
Tasks Property string[] Tasks {get;set;}
521521
UpdateUser Property string UpdateUser {get;set;}
522-
Info PropertySet Info {Name, Status, Version, GitBranch, Tasks, Tags, Comment}
523-
versionInfo PropertySet versionInfo {Name, Status, Version, GitBranch, LastUpdate}
524-
Age ScriptProperty System.Object Age {get=(Get-Date) - $this.lastUpdate;}
522+
Info PropertySet Info {Name, Status, Version, GitBranch, Tasks...
523+
versionInfo PropertySet versionInfo {Name, Status, Version, GitBranch...
524+
Age ScriptProperty System.Object Age {get=(Get-Date) - $this.las...
525525
```
526526

527527
The property sets make it easier to display a group of related properties.
@@ -530,13 +530,23 @@ The property sets make it easier to display a group of related properties.
530530
PS C:\Scripts\PSProjectStatus> Get-PSProjectstatus | Select Info
531531
532532
Name : PSProjectStatus
533-
Status : Updating
534-
Version : 0.12.0
535-
GitBranch : 0.12.0
536-
Tasks : {Create TUI-based management tools, Consider extending schema for a structured Task item [Issue 10],
537-
Pester tests, Update README…}
538-
Tags : {json}
533+
Status : AcceptanceTesting
534+
Version : 0.13.0
535+
GitBranch : 0.13.0
536+
Tasks : {Create TUI-based management tools, Consider extending schema for a
537+
structured Task item [Issue 10],
538+
Pester tests}
539+
Tags : {}
539540
Comment : none
541+
542+
PS C:\Scripts\PSProjectStatus> Get-PSProjectStatus | Select-Object VersionInfo,age
543+
544+
Name : PSProjectStatus
545+
Status : AcceptanceTesting
546+
Version : 0.13.0
547+
GitBranch : 0.13.0
548+
LastUpdate : 12/30/2023 1:43:37 PM
549+
Age : 00:03:56.0703713
540550
```
541551

542552
### Formatting
@@ -579,6 +589,37 @@ The commands in this module use localized string data to display verbose, warnin
579589

580590
![Sample verbose output](images/verbose-output.png)
581591

592+
The defined ANSI sequences are stored in a variable called `$PSProjectANSI`. You can modify this variable to change the color for each command.
593+
594+
```powershell
595+
$PSProjectANSI = @{
596+
'Get-PSProjectGitStatus' = '[1;38;5;51m'
597+
'Get-PSProjectReport' = '[1;38;5;111m'
598+
'Get-PSProjectStatus' = '[1;96m'
599+
'Get-PSProjectTask' = '[1;38;5;10m'
600+
'New-PSProjectStatus' = '[1;38;5;208m'
601+
'New-PSProjectTask' = '[1;38;5;159m'
602+
'Remove-PSProjectTask' = '[1;38;5;195m'
603+
'Set-PSProjectStatus' = '[1;38;5;214m'
604+
Default = '[1;38;5;51m'
605+
}
606+
```
607+
608+
You can change a setting by modifying the variable. You can use ANSI sequences or `$PSStyle`
609+
610+
```powershell
611+
$PSProjectANSI["Get-PSProjectStatus"] = "[1;92m"
612+
$PSProjectANSI["Get-PSProjectGitStatus"] = $PSStyle.Foreground.Cyan
613+
```
614+
615+
These changes only persist for the duration of your PowerShell session or until you re-import the module. Use your profile script to import the module and update the variable.
616+
617+
```powershell
618+
Import-Module PSProjectStatus
619+
$PSProjectANSI["Get-PSProjectStatus"] = "[1;38;5;140m"
620+
$PSProjectANSI["Get-PSProjectGitStatus"] = "[1;38;5;77m"
621+
```
622+
582623
You must use a PowerShell console that supports ANSI escape sequences. The PowerShell ISE __does not__ support this feature.
583624

584625
## Editor Integration

docs/Get-PSProjectGitStatus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Get-PSProjectGitStatus [<CommonParameters>]
1919

2020
## DESCRIPTION
2121

22-
Presumably you are using git to manage your project. If so, some git-related information is included in the PSProjectStatus output. Get-PSProjectGitStatus is intended to provide more git-specific details. You should run this command in the root of your project directory. If the project is not a git repository, nothing will be returned.
22+
Presumably you are using git to manage your project. If so, some git-related information is included in the PSProjectStatus output. Get-PSProjectGitStatus is intended to provide more git-specific details. You should run this command in the root of your project directory. If the project is not git initialized, nothing will be returned.
2323

2424
## EXAMPLES
2525

docs/Get-PSProjectReport.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Get-PSProjectReport [-Path] <String> [-Status <PSProjectStatus>]
3333

3434
## DESCRIPTION
3535

36-
The PSProjectStatus module makes an assumption that the majority of your projects are organized under a parent folder like C:\Scripts. This command is designed to make it easier to identify and manage projects you are working on. The default behavior is to get PSProject information from the top-level folders in your root directory. But you can also filter on status or age.
36+
The PSProjectStatus module makes an assumption that the majority of your projects are organized under a parent folder like C:\Scripts. This command is designed to make it easier to identify and manage projects you are working on. The default behavior is to get PSProject information from the top-level folders in your root directory. But you can also filter on status, age, or tag.
3737

3838
## EXAMPLES
3939

@@ -70,10 +70,10 @@ Get PSProjects modified within the last 10 days.
7070
### Example 3
7171

7272
```powershell
73-
PS C>\> Get-PSProjectReport c:\scripts -NewerThan 30 | Select Path,Name,Status,LastUpdate | Out-GridView -Title "Select a project" -OutputMode Single | foreach-object { code $_.path }
73+
PS C>\> Get-PSProjectReport c:\scripts -NewerThan 60 | Select-Object Path,Name,Status,Tags,LastUpdate | Out-GridView -Title "Select a project" -OutputMode Single | Foreach-Object { set-location $_.path ; code $_.path }
7474
```
7575

76-
Get projects modified in the last 30 days and send to Out-GridView. The selected project folder will be opened in VSCode.
76+
Get projects modified in the last 60 days and send to Out-GridView. The selected project folder will be opened in VSCode.
7777

7878
## PARAMETERS
7979

docs/Get-PSProjectStatus.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ PS C:\Scripts\PSClock> Get-PSProjectStatus
3030
3131
Name: PSClock [C:\Scripts\PSClock]
3232
33-
LastUpdate Status Tasks GitBranch Age
34-
---------- ------ ----- --------- ---
35-
3/2/2022 3:43:34 PM Stable main 12.19:14
33+
LastUpdate Status Tasks GitBranch Age
34+
---------- ------ ----- --------- ---
35+
3/2/2022 3:43:34 PM Stable main 12.19:14
3636
```
3737

3838
Get the status from the current directory.
@@ -44,46 +44,48 @@ C:\Scripts\ dir -Directory | Get-PSProjectStatus -WarningAction SilentlyContinue
4444
4545
Name: ADReportingTools [C:\Scripts\ADReportingTools]
4646
47-
LastUpdate Status Tasks GitBranch Age
48-
---------- ------ ----- --------- ---
49-
6/21/2021 4:47:11 PM Updating {Publish new releas… 1.4.0 266.17:59
47+
LastUpdate Status Tasks GitBranch Age
48+
---------- ------ ----- --------- ---
49+
6/21/2021 4:47:11 PM Updating {Publish new re… 1.4.0 266.17:59
5050
5151
Name: GitDevTest [C:\scripts\GitDevTest]
5252
53-
LastUpdate Status Tasks GitBranch Age
54-
---------- ------ ----- --------- ---
55-
2/3/2022 4:50:37 PM Stable {update readme, add… master 39.17:55
53+
LastUpdate Status Tasks GitBranch Age
54+
---------- ------ ----- --------- ---
55+
2/3/2022 4:50:37 PM Stable {update readme,… master 39.17:55
5656
5757
Name: MyTasks [C:\Scripts\MyTasks]
5858
59-
LastUpdate Status Tasks GitBranch Age
60-
---------- ------ ----- --------- ---
61-
10/14/2020 1:29:59 PM Stable master 516.21:16
59+
LastUpdate Status Tasks GitBranch Age
60+
---------- ------ ----- --------- ---
61+
10/14/2020 1:29:59 PM Stable master 516.21:16
6262
...
6363
```
6464

65-
Get status for multiple projects.
65+
Get status for multiple projects. You could also use the Get-PSProjectReport command.
6666

6767
### Example 3
6868

6969
```powershell
7070
PS C:\Scripts\PSCalendar> Get-PSProjectStatus | Format-List
7171
72-
Project: PSCalendar [C:\Scripts\PSCalendar]
72+
Project: PSCalendar [C:\scripts\PSCalendar]
7373
7474
Version : 2.9.0
75-
Status : Patching
76-
Tasks : {Update help documentation, Issue #31, Issue #34, Issue #33}
77-
GitBranch : 2.9.0
78-
LastUpdate : 3/3/2022 10:24:49 AM
75+
Status : Stable
76+
Tasks : {Update Help, Issue 34}
77+
Tags : {}
78+
GitBranch : master
79+
LastUpdate : 3/1/2022 5:50:00 AM
80+
Age : 669.10:07:19
7981
```
8082

8183
Use the default List view. This makes it easier to view the tasks.
8284

8385
### Example 4
8486

8587
```powershell
86-
PS C:\Scripts\PSProjectStatus> Get-PSProjectStatus | Select-Object VersionInfo,age
88+
PS C:\Scripts\PSProjectStatus> Get-PSProjectStatus | Select-Object VersionInfo,Age
8789
8890
Name : PSProjectStatus
8991
Status : Updating
@@ -136,3 +138,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
136138
[Set-PSProjectStatus](Set-PSProjectStatus.md)
137139
138140
[New-PSProjectStatus](New-PSProjectStatus.md)
141+
142+
[Get-PSProjectReport](Get-PSProjectReport.md)

0 commit comments

Comments
 (0)