Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Jun 30, 2023
1 parent 9179dd8 commit 88dc9cc
Show file tree
Hide file tree
Showing 15 changed files with 998 additions and 29 deletions.
9 changes: 6 additions & 3 deletions PSWorkItem.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@{
RootModule = 'PSWorkItem.psm1'
ModuleVersion = '1.0.1'
ModuleVersion = '1.1.0'
CompatiblePSEditions = 'Core'
GUID = '4d3ff215-69ea-4fe6-8ad6-97ffc3a15bfb'
Author = 'Jeff Hicks'
Expand All @@ -22,7 +22,8 @@
FormatsToProcess = @(
'formats\psworkitemdatabase.format.ps1xml',
'formats\psworkItem.format.ps1xml',
'.\formats\psworkitemreport.format.ps1xml'
'formats\psworkitemreport.format.ps1xml',
'formats\psworkitemcategory.format.ps1xml'
)
FunctionsToExport = @(
'Get-PSWorkItem',
Expand All @@ -39,7 +40,9 @@
'Get-PSWorkItemDatabase',
'Get-PSWorkItemData',
'Get-PSWorkItemReport',
'Update-PSWorkItemDatabase'
'Update-PSWorkItemDatabase',
'Update-PSWorkItemPreferences',
'Set-PSWorkItemCategory'
)
CmdletsToExport = @()
VariablesToExport = @()
Expand Down
31 changes: 22 additions & 9 deletions PSWorkItem.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,33 @@ class PSWorkItemDatabase {

#endregion

#make this variable global instead of exporting so that I don't have to use Export-ModuleMember 7/28/2022 JDH
$global:PSWorkItemPath = Join-Path -Path $HOME -ChildPath "PSWorkItem.db"

<#
Default categories when creating a new database file.
This will be a module-scoped variable
#>

$PSWorkItemDefaultCategories = "Work", "Personal", "Project", "Other"
#region settings and configuration

#a global hashtable used for formatting PSWorkItems
$global:PSWorkItemCategory = @{
"Work" = $PSStyle.Foreground.Cyan
"Personal" = $PSStyle.Foreground.Green
}

#import and use the preference file if found
$PreferencePath = Join-Path -Path $HOME -ChildPath ".psworkitempref.json"
If (Test-Path $PreferencePath) {
$importPref = Get-Content $PreferencePath | ConvertFrom-Json
$global:PSWorkItemPath = $importPref.Path
$importPref.categories.foreach({$PSWorkItemCategory[$_.category]=$_.ansi})
}
else {
#make this variable global instead of exporting so that I don't have to use Export-ModuleMember 7/28/2022 JDH
$global:PSWorkItemPath = Join-Path -Path $HOME -ChildPath "PSWorkItem.db"
}

<#
Default categories when creating a new database file.
This will be a module-scoped variable, not exposed to the user
#>

$PSWorkItemDefaultCategories = "Work", "Personal", "Project", "Other"

Register-ArgumentCompleter -CommandName New-PSWorkItem, Get-PSWorkItem, Set-PSWorkItem, Get-PSWorkItemArchive,Remove-PSWorkItemArchive -ParameterName Category -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
#PowerShell code to populate $WordToComplete
Expand All @@ -96,3 +107,5 @@ Register-ArgumentCompleter -CommandName New-PSWorkItem, Get-PSWorkItem, Set-PSWo
[System.Management.Automation.CompletionResult]::new($_.category, $_.category, 'ParameterValue', $_.description)
}
}

#endregion
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ This module requires PowerShell 7.2 or later and a 64-bit version of PowerShell,
Install-Module PSWorkItem [-scope CurrentUser]
```

Module installation will also install the required [MySQLite](https://github.com/jdhitsolutions/MySQLite) module from the PowerShell Gallery.
:heavy_exclamation_mark: Module installation will also install the required [MySQLite](https://github.com/jdhitsolutions/MySQLite) module from the PowerShell Gallery.

## PSWorkItem Database Change

**If you were using a version of this module prior to v1.0.0, this note applies to you.**

Version 1.0.0 of the PSWorkItem module introduced a structural change to the database tables. If you are using a database created in an earlier version, you need to run [Update-PSWorkItemDatabase](docs/Update-PSWorkItemDatabase.md) before adding, changing, or completing work items. It is recommended that you backup your database file before running this command.

As an alternative, you could export your work items, delete the database file, initialize a new one, and re-import your work items.

During the upgrade, a new table column called ID is added to the Tasks and Archive database tables. In the Tasks table, the ID column for existing entries will be set to the row id, which should be the task number you are used to seeing. In the archive table, existing entries will get an ID value of 0, since it is impossible to know the original ID number. This database change corrects this problem. Going forward, the PSWorkItem ID will remain the same when you complete it and move the item to the Archive table.
>Version 1.0.0 of the PSWorkItem module introduced a structural change to the database tables. If you are using a database created in an earlier version, you need to run [Update-PSWorkItemDatabase](docs/Update-PSWorkItemDatabase.md) before adding, changing, or completing work items. It is recommended that you back up your database file before running this command.
>As an alternative, you could export your work items, delete the database file, initialize a new one, and re-import your work items.
>During the upgrade, a new table column called ID is added to the Tasks and Archive database tables. In the Tasks table, the ID column for existing entries will be set to the row id, which should be the task number you are used to seeing. In the archive table, existing entries will get an ID value of 0, since it is impossible to know the original ID number. This database change corrects this problem. Going forward, the PSWorkItem ID will remain the same when you complete it and move the item to the Archive table.
## Module Commands and Design

Expand All @@ -31,15 +29,18 @@ During the upgrade, a new table column called ID is added to the Tasks and Archi
- [Get-PSWorkItem](docs/Get-PSWorkItem.md)
- [Get-PSWorkItemArchive](docs/Get-PSWorkItemArchive.md)
- [Get-PSWorkItemCategory](docs/Get-PSWorkItemCategory.md)
- [Get-PSWorkItemData](docs/Get-PSWorkItemData.md)
- [Get-PSWorkItemDatabase](docs/Get-PSWorkItemDatabase.md)
- [Get-PSWorkItemReport](docs/Get-PSWorkItemReport.md)
- [Initialize-PSWorkItemDatabase](docs/Initialize-PSWorkItemDatabase.md)
- [New-PSWorkItem](docs/New-PSWorkItem.md)
- [Remove-PSWorkItem](docs/Remove-PSWorkItem.md)
- [Remove-PSWorkItemArchive](docs/Remove-PSWorkItemArchive.md)
- [Remove-PSWorkItemCategory](docs/Remove-PSWorkItemCategory.md)
- [New-PSWorkItem](docs/New-PSWorkItem.md)
- [Set-PSWorkItem](docs/Set-PSWorkItem.md)
- [Set-PSWorkItemCategory](docs/Set-PSWorkItemCategory.md)
- [Update-PSWorkItemDatabase](docs/Update-PSWorkItemDatabase.md)
- [Update-PSWorkItemPreferences](docs/Update-PSWorkItemPreferences.md)

The module is based on three tables in a SQLite database file. The primary `Tasks` table is where active items are stored.

Expand Down Expand Up @@ -229,7 +230,7 @@ You can modify this hashtable as you would any other hashtable.
$PSWorkItemCategory.Add("Event","`e[38;5;153m")
```

The entry will have no effect unless the category is defined in the database.
The entry will have no effect unless the category is defined in the database. The category customizations last for the duration of your PowerShell session or until the module is removed. Add your customizations to your PowerShell profile script.

> Note that when you view the hashtable, you won't see any values because they escape sequences are non-printable.
Expand Down Expand Up @@ -338,8 +339,8 @@ rowid : 19

## Future Tasks or Commands

+ Password protection options.
+ A WPF and/or TUI form for entering new work items.
+ A WPF and/or TUI form for displaying and managing work items.
- Password protection options.
- A WPF and/or TUI form for entering new work items.
- A WPF and/or TUI form for displaying and managing work items and categories

If you have an enhancement suggestion, please submit it as an [Issue](https://github.com/jdhitsolutions/PSWorkItem/issues).
15 changes: 14 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## [Unreleased]

## [1.1.0] - 2023-06-30

### Added

- Added a format file for PSWorkItemCategory to display categories using the designated color scheme. [Issue #10](https://github.com/jdhitsolutions/PSWorkItem/issues/10)]
- Added command `Update-PSWorkItemPreferences` to store user preferences in a JSON file stored in `$HOME`. If the file is found, settings will be imported.
- Added command `Set-PSWorkItemCategory` [Issue 11](https://github.com/jdhitsolutions/PSWorkItem/issues/11)

### Changed

- Updated README.

## [1.0.1] - 2023-03-13

### Changed
Expand Down Expand Up @@ -178,7 +190,8 @@ This is a major update with significant changes. If this is your first time inst
- Initial files
- Created Module outline

[Unreleased]: https://github.com/jdhitsolutions/PSWorkItem/compare/v1.0.1..HEAD
[Unreleased]: https://github.com/jdhitsolutions/PSWorkItem/compare/v1.1.0..HEAD
[1.1.0]: https://github.com/jdhitsolutions/PSWorkItem/compare/v1.0.1..v1.1.0
[1.0.1]: https://github.com/jdhitsolutions/PSWorkItem/compare/v1.0.0..v1.0.1
[1.0.0]: https://github.com/jdhitsolutions/PSWorkItem/compare/v0.9.0..v1.0.0
[0.9.0]: https://github.com/jdhitsolutions/PSWorkItem/compare/v0.8.0..v0.9.0
Expand Down
2 changes: 2 additions & 0 deletions docs/Add-PSWorkItemCategory.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,6 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[Get-PSWorkItemCategory](Get-PSWorkItemCategory.md)
[Set-PSWorkItemCategory](Set-PSWorkItemCategory.md)
[Remove-PSWorkItemCategory](Remove-PSWorkItemCategory.md)
2 changes: 2 additions & 0 deletions docs/Remove-PSWorkItemCategory.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
[Add-PSWorkItemCategory](Add-PSWorkItemCategory.md)
[Get-PSWorkItemCategory](Get-PSWorkItemCategory.md)
[Set-PSWorkItemCategory](Set-PSWorkItemCategory.md)
177 changes: 177 additions & 0 deletions docs/Set-PSWorkItemCategory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
schema: 2.0.0
---

# Set-PSWorkItemCategory

## SYNOPSIS

Update an existing PSWorkItem category

## SYNTAX

```yaml
Set-PSWorkItemCategory [-Category] <String> [-Description <String>]
[-NewName <String>] [-Path <String>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION

This command will update an existing PSWorkItem category. The category name is case-sensitive. Use caution when renaming a category that has active tasks using the old category name.

## EXAMPLES

### Example 1

```powershell
PS C:\> Set-PsworkItemCategory -Category work -Description "Uncategorized work activities" -PassThru
Category Description
-------- -----------
Work Uncategorized work activities
```

## PARAMETERS

### -Category

Specify a case-sensitive category name.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Name

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### -Confirm
Prompts you for confirmation before running the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Description
Specify a category comment or description.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -NewName
Specify a new name for the category.
This is case-sensitive.
Be careful renaming a category with active tasks using the old category name.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -PassThru
Write the updated category to the pipeline.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Path
The path to the PSWorkItem SQLite database file.
It should end in .db
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: $PSWorkItemPath
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
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).
## INPUTS
### System.String
## OUTPUTS
### None
### PSWorkItemCategory
## NOTES
## RELATED LINKS
[Add-PSWorkItemCategory](Add-PSWorkItemCategory.md)
[Get-PSWorkItemCategory](Get-PSWorkItemCategory.md)
[Remove-PSWorkItemCategory](Remove-PSWorkItemCategory.md)
Loading

0 comments on commit 88dc9cc

Please sign in to comment.