Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Aug 2, 2022
1 parent a423d94 commit 303837d
Show file tree
Hide file tree
Showing 23 changed files with 502 additions and 154 deletions.
29 changes: 14 additions & 15 deletions PSWorkItem.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@{
RootModule = 'PSWorkItem.psm1'
ModuleVersion = '0.3.0'
ModuleVersion = '0.4.0'
CompatiblePSEditions = 'Core'
GUID = '4d3ff215-69ea-4fe6-8ad6-97ffc3a15bfb'
Author = 'Jeff Hicks'
Expand All @@ -14,27 +14,26 @@
PowerShellVersion = '7.2'
DotNetFrameworkVersion = '4.6'
ProcessorArchitecture = 'Amd64'
RequiredModules = @("mySQLite")
RequiredModules = @(@{ModuleName="mySQLite";ModuleVersion="0.9.2"})
# TypesToProcess = @()
FormatsToProcess = @('formats/psworkitemdatabase.format.ps1xml','formats/psworkitem.format.ps1xml')
FunctionsToExport = 'Get-PSWorkItem','Set-PSWorkItem','Remove-PSWorkItem',
'Initialize-PSWorkItemDatabase','Complete-PSWorkItem','Get-PSWorkitemCategory',
'Add-PSWorkItemCategory','Get-PSWorkItemArchive','New-PSWorkItem','Remove-PSWorkItemCategory',
'Get-PSWorkItemDatabase'
CmdletsToExport = ''
VariablesToExport = ''
AliasesToExport = @('gwi','nwi','swi','rwi','cwi')
FormatsToProcess = @('formats/psworkitemdatabase.format.ps1xml', 'formats/psworkitem.format.ps1xml')
FunctionsToExport = 'Get-PSWorkItem', 'Set-PSWorkItem', 'Remove-PSWorkItem',
'Initialize-PSWorkItemDatabase', 'Complete-PSWorkItem', 'Get-PSWorkitemCategory',
'Add-PSWorkItemCategory', 'Get-PSWorkItemArchive', 'New-PSWorkItem', 'Remove-PSWorkItemCategory',
'Get-PSWorkItemDatabase','Export-PSWorkItemDatabase','Import-PSWorkItemDatabase'
CmdletsToExport = @()
VariablesToExport = @()
AliasesToExport = @('gwi', 'nwi', 'swi', 'rwi', 'cwi')
PrivateData = @{
PSData = @{
Tags = @('database','sqlite','to-do','project-management','tasks')
# LicenseUri = ''
# ProjectUri = ''
Tags = @('database', 'sqlite', 'to-do', 'project-management', 'tasks')
LicenseUri = 'https://github.com/jdhitsolutions/PSWorkItem/blob/main/License.txt'
ProjectUri = 'https://github.com/jdhitsolutions/PSWorkItem'
# IconUri = ''
# ReleaseNotes = ''
# Prerelease = ''
# RequireLicenseAcceptance = $false
ExternalModuleDependencies = @("mySQLite")

ExternalModuleDependencies = @(@{ModuleName="mySQLite";ModuleVersion="0.9.2"})
} # End of PSData hashtable

} # End of PrivateData hashtable
Expand Down
18 changes: 8 additions & 10 deletions PSWorkItem.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Foreach-Object {
. $_.FullName
}

#region class definitions
#define item class
class PSWorkItem {
#this can be the ROWID of the item in the database
Expand Down Expand Up @@ -54,10 +55,16 @@ Update-TypeData -TypeName PSWorkitem -MemberType ScriptProperty -MemberName Over
Update-TypeData -TypeName PSWorkItem -MemberType ScriptProperty -MemberName "TimeRemaining" -Value {New-Timespan -end $this.DueDate -start (Get-Date)} -force
Update-TypeData -TypeName PSWorkItemArchive -MemberType AliasProperty -MemberName "CompletedDate" -Value 'TaskModified' -force

#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"

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

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

Register-ArgumentCompleter -CommandName New-PSWorkItem,Get-PSWorkItem,Set-PSWorkItem,Get-PSWorkItemArchive -ParameterName Category -ScriptBlock {
Expand All @@ -71,12 +78,3 @@ Register-ArgumentCompleter -CommandName New-PSWorkItem,Get-PSWorkItem,Set-PSWork
[System.Management.Automation.CompletionResult]::new($_.category, $_.category, 'ParameterValue', $_.description)
}
}

<#
Export-ModuleMember -Variable PSWorkItemPath -alias 'gwi','nwi','swi' -Function 'Get-PSWorkItem','Set-PSWorkItem',
'Remove-PSWorkItem','Initialize-PSWorkItemDatabase','Complete-PSWorkItem','Get-PSWorkitemCategory',
'Get-PSWorkItemArchive','New-PSWorkItem','Remove-PSWorkItemCategory','Add-PSWorkItemCategory',
'Get-PSWorkItemDatabase'
#>
40 changes: 33 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# PSWorkItem

This module is a replacement for the [MyTasks](https://github.com/jdhitsolutions/MyTasks) module. That module offered simple task or to-do management. All data was stored in XML files. This module conceptually is designed the same way but instead uses a SQLite database file.
[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSWorkItem.png?style=for-the-badge&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSWorkItem/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSWorkItem.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSWorkItem/)

This module is a replacement for the [MyTasks](https://github.com/jdhitsolutions/MyTasks) module. That PowerShell module offered simple task or to-do management. All data was stored in XML files. This module conceptually is designed the same way but instead uses a SQLite database file. The module commands are wrapped around functions from the MySQLite module.

## Installation

This module requires PowerShell 7.2 or later and a 64-bit version of PowerShell, which most people are running. You will eventually be able to install this module from the PowerShell Gallery.
This module requires PowerShell 7.2 or later and a 64-bit version of PowerShell, which most people are running. __The module requires a Windows platform.__ You can install this module from the PowerShell Gallery.

```powershell
Install-Module PSWorkItem
Install-Module PSWorkItem [-scope CurrentUser]
```

Installation will also install the required [MySQLite](https://github.com/jdhitsolutions/MySQLite) module.
Expand Down Expand Up @@ -105,7 +107,7 @@ SRV server management tasks
If you need to update a category, you can re-add it using `-Force`. The category name is case-sensitive.

```powershell
PS C:\> > Add-PSWorkItemCategory -Category Work -Description "business related tasks" -Passthru -Force
PS C:\> Add-PSWorkItemCategory -Category Work -Description "business related tasks" -Passthru -Force
Category Description
-------- -----------
Expand All @@ -114,16 +116,22 @@ Work business related tasks

Or you can use `Remove-PSWorkItemCategory` and start all over.

Commands that have a `Category` parameter should have tab-completion.
Commands that have a `Category` parameter should have tab completion.

## Adding a Task

Use `New-PSWorkItem` to define a task. You need to specify a name and category. You must specify a valid category. By default the task will be configured with a due date of 30 days from now. You can specify a different datetime or specify the number of days from now.
Use `New-PSWorkItem` to define a task. You need to specify a name and category. You must specify a valid, pre-defined category. By default, the task will be configured with a due date of 30 days from now. You can specify a different datetime or specify the number of days from now.

```powershell
New-PSWorkItem -Name "Publish PSWorkitem" -DaysDue 3 -Category Project
```

Because you have to specify a task, you might want to set a default category.

```powershell
$PSDefaultParameterValues.Add("New-PSWorkItem:Category","Work")
```

## Viewing Tasks

The primary command in this module, `Get-PSWorkItem`, which has an alias of `gwi`, has several parameter sets to help you select PSWorkItems.
Expand Down Expand Up @@ -182,7 +190,25 @@ Remove-PSWorkItem -id 13

This will delete the item from the Tasks database.

## Database Backup

This module doesn't have any specific commands for backing up or restoring a database file. But you can use the `Export-MySQLiteDB` command to export the PSWorkItem database file to a JSON file.

```powershell
Export-MySQLiteDB -path $PSWorkItemPath -Destination d:\backups\pwi.json
```

Use `Import-MySQLiteDB` to import the file and rebuild the database file. It is recommended to restore to a new location, verify the database, then copy the file to `$PSWorkItemPath`.

## Database Sample

A sample database has been created in the module's Samples directory. You can specify the path to the sample database or copy it to `$PSWorkItemPath` to try the module out. Note that it is very likely that many of the tasks will be flagged as overdue by the time you view the database.

If you copy the sample to `$PSWorkItemPath`, delete the file before creating your database file.

## Future Tasks or Commands

+ Backup database file
+ Password protection options
+ A WPF form for entering new work items

If you have enhancement suggestions, please submit it as an Issue.
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog for PSWorkItem

## 0.4.0

+ Updated `README`.
+ Added online help links.
+ Help updates.
+ Updated module manifest.
+ Made `Category` and `Description` positional parameters in `New-PSWorkItem`.
+ Defined a module dependency on version 0.9.2 or later of the MySQLite module.
+ Created a sample database file.
+ Published to the PowerShell Gallery.

## 0.3.0

+ Added format file `psworkitem.format.ps1xml`.
Expand Down
10 changes: 5 additions & 5 deletions docs/Add-PSWorkItemCategory.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3JjqVlD
schema: 2.0.0
---

Expand Down Expand Up @@ -53,7 +53,7 @@ Accept wildcard characters: False
### -Confirm
Prompts you for confirmation before running the cmdlet.
Prompts you for confirmation before running the command.
```yaml
Type: SwitchParameter
Expand Down Expand Up @@ -132,8 +132,8 @@ Accept wildcard characters: False
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Shows what would happen if the command runs.
The command is not run.
```yaml
Type: SwitchParameter
Expand All @@ -149,7 +149,7 @@ 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).
This command 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
Expand Down
10 changes: 5 additions & 5 deletions docs/Complete-PSWorkItem.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3cUDMOX
schema: 2.0.0
---

Expand Down Expand Up @@ -39,7 +39,7 @@ Mark a PSWorkItem as completed and move it to the Archive table. The PSWorkItem

### -Confirm

Prompts you for confirmation before running the cmdlet.
Prompts you for confirmation before running the command.

```yaml
Type: SwitchParameter
Expand Down Expand Up @@ -88,8 +88,8 @@ Accept wildcard characters: False
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Shows what would happen if the command runs.
The command is not run.
```yaml
Type: SwitchParameter
Expand Down Expand Up @@ -136,7 +136,7 @@ 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).
This command 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
Expand Down
4 changes: 2 additions & 2 deletions docs/Get-PSWorkItem.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3OFhPRm
schema: 2.0.0
---

Expand Down Expand Up @@ -278,7 +278,7 @@ 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).
This command 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
Expand Down
4 changes: 2 additions & 2 deletions docs/Get-PSWorkItemArchive.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3cT3ljn
schema: 2.0.0
---

Expand Down Expand Up @@ -137,7 +137,7 @@ 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).
This command 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
Expand Down
4 changes: 2 additions & 2 deletions docs/Get-PSWorkItemCategory.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3JlrafZ
schema: 2.0.0
---

Expand Down Expand Up @@ -93,7 +93,7 @@ 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).
This command 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
Expand Down
4 changes: 2 additions & 2 deletions docs/Get-PSWorkItemDatabase.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3P0DHXH
schema: 2.0.0
---

Expand Down Expand Up @@ -77,7 +77,7 @@ 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).
This command 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
Expand Down
10 changes: 5 additions & 5 deletions docs/Initialize-PSWorkItemDatabase.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSWorkItem-help.xml
Module Name: PSWorkItem
online version:
online version: https://bit.ly/3PIdz4O
schema: 2.0.0
---

Expand Down Expand Up @@ -91,7 +91,7 @@ The passthru output shows the new table definitions.

### -Confirm

Prompts you for confirmation before running the cmdlet.
Prompts you for confirmation before running the command.

```yaml
Type: SwitchParameter
Expand Down Expand Up @@ -154,8 +154,8 @@ Accept wildcard characters: False
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Shows what would happen if the command runs.
The command is not run.
```yaml
Type: SwitchParameter
Expand All @@ -171,7 +171,7 @@ 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).
This command 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
Expand Down
Loading

0 comments on commit 303837d

Please sign in to comment.