diff --git a/MyTasks.psd1 b/MyTasks.psd1 index 6312630..6611a7a 100644 Binary files a/MyTasks.psd1 and b/MyTasks.psd1 differ diff --git a/MyTasks.psm1 b/MyTasks.psm1 index 32d1cec..419f77e 100644 --- a/MyTasks.psm1 +++ b/MyTasks.psm1 @@ -26,13 +26,15 @@ $myTaskDefaultCategories = "Work","Personal","Other","Customer" . $psscriptroot\MyTasksFunctions.ps1 #define some aliases -Set-Alias -Name gmt -Value Get-MyTask -Set-Alias -Name smt -Value Set-MyTask -Set-Alias -Name shmt -Value Show-MyTask -Set-Alias -Name rmt -Value Remove-MyTask -Set-Alias -Name cmt -Value Complete-MyTask -Set-Alias -Name nmt -Value New-MyTask -Set-Alias -Name Archive-MyTask -Value Save-MyTask +$aliases = @() +$aliases+= Set-Alias -Name gmt -Value Get-MyTask -PassThru +$aliases+= Set-Alias -Name smt -Value Set-MyTask -PassThru +$aliases+= Set-Alias -Name shmt -Value Show-MyTask -PassThru +$aliases+= Set-Alias -Name rmt -Value Remove-MyTask -PassThru +$aliases+= Set-Alias -Name cmt -Value Complete-MyTask -PassThru +$aliases+= Set-Alias -Name nmt -Value New-MyTask -PassThru +$aliases+= Set-Alias -name task -value New-MyTask -PassThru +$aliases+= Set-Alias -Name Archive-MyTask -Value Save-MyTask -PassThru #define a hashtable of parameters to splat to Export-ModuleMember $exportParams = @{ @@ -40,7 +42,7 @@ Variable = "myTaskPath","myTaskDefaultCategories","myTaskArchivePath","mytaskhom Function = "New-MyTask","Set-MyTask","Remove-MyTask","Get-MyTask", "Show-MyTask","Complete-MyTask","Get-MyTaskCategory","Add-MyTaskCategory", "Remove-MyTaskCategory","Backup-MyTaskFile","Save-MyTask" -Alias = "gmt","rmt","shmt","smt","cmt","nmt","Archive-MyTask" +Alias = $aliases.Name } #exported via manifest diff --git a/MyTasksFunctions.ps1 b/MyTasksFunctions.ps1 index 5054808..5dfd8f8 100644 --- a/MyTasksFunctions.ps1 +++ b/MyTasksFunctions.ps1 @@ -27,12 +27,12 @@ Class MyTask { #set task as completed - [void]CompleteTask() { + [void]CompleteTask([datetime]$CompletedDate) { write-verbose "[CLASS ] Completing task: $($this.name)" $this.Completed = $True $this.Progress = 100 $this.Overdue = $False - $this.TaskModified = Get-Date + $this.TaskModified = $CompletedDate } #check if task is overdue and update @@ -41,7 +41,10 @@ Class MyTask { #only mark as overdue if not completed and today is greater than the due date Write-Verbose "[CLASS ] Comparing $($this.DueDate) due date to $(Get-Date)" - if (((Get-Date) -gt $this.DueDate) -AND (-Not $this.completed)) { + if ($This.completed) { + $this.Overdue = $False + } + elseif ((Get-Date) -gt $this.DueDate) { $this.Overdue = $True } else { @@ -125,7 +128,7 @@ Function New-MyTask { )] [string]$Name, - [Parameter(ValueFromPipelineByPropertyName, ParameterSetName = "Date")] + [Parameter(Position = 1,ValueFromPipelineByPropertyName, ParameterSetName = "Date")] [ValidateNotNullorEmpty()] [dateTime]$DueDate = (Get-Date).AddDays(7), @@ -151,6 +154,7 @@ Function New-MyTask { $ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute $ParameterAttribute.Mandatory = $true $ParameterAttribute.ValueFromPipelineByPropertyName = $True + $ParameterAttribute.Position = 2 # Add the attributes to the attributes collection $AttributeCollection.Add($ParameterAttribute) @@ -508,7 +512,7 @@ Function Remove-MyTask { } #Remove-MyTask Function Get-MyTask { - [cmdletbinding(DefaultParameterSetName = "Name")] + [cmdletbinding(DefaultParameterSetName = "Days")] Param( [Parameter( @@ -523,7 +527,7 @@ Function Get-MyTask { [Parameter(ParameterSetName = "Completed")] [switch]$Completed, [Parameter(ParameterSetName = "Days")] - [int]$DaysDue + [int]$DaysDue = 30 ) DynamicParam { @@ -637,10 +641,12 @@ Function Show-MyTask { #colorize output using Write-Host #this may not work in the PowerShell ISE - [cmdletbinding(DefaultParameterSetName = "none")] + [cmdletbinding(DefaultParameterSetName = "Days")] Param( [Parameter(ParameterSetName = "all")] - [switch]$All + [switch]$All, + [Parameter(ParameterSetName = "Days")] + [int32]$DaysDue = 30 ) DynamicParam { @@ -689,6 +695,7 @@ Function Show-MyTask { Process { #run Get-MyTask + Write-Verbose "[PROCESS] Getting Tasks" $tasks = Get-MyTask @PSBoundParameters #convert tasks to a text table @@ -710,7 +717,7 @@ Function Show-MyTask { #add the incoming object as the object for Write-Host $pHash.object = $_ - + Write-Verbose "[PROCESS] Analyzing $_ " #test if DueDate is within 24 hours if ($rx.IsMatch($_)) { $hours = (($rx.Match($_).Value -as [datetime]) - (Get-Date)).totalhours @@ -718,25 +725,26 @@ Function Show-MyTask { #test if task is complete if ($_ -match '\b100\b$') { + Write-Verbose "[PROCESS] Detected as completed" $complete = $True - } else { + Write-Verbose "[PROCESS] Detected as incomplete" $complete = $False } #select a different color for overdue tasks - if ($_ -match "\bTrue\b") { + if ($complete) { + #display completed tasks in green + $phash.ForegroundColor = "Green" + } + elseif ($_ -match "\bTrue\b") { $phash.ForegroundColor = "Red" } elseif ($hours -le 24 -AND (-Not $complete)) { $phash.ForegroundColor = "Yellow" $hours = 999 } - elseif ($complete) { - #display completed tasks in green - $phash.ForegroundColor = "Green" - } else { if ($pHash.ContainsKey("foregroundcolor")) { #remove foreground color so that Write-Host uses @@ -772,6 +780,15 @@ Function Complete-MyTask { [ValidateNotNullorEmpty()] [string]$Name, + [Parameter( + Mandatory, + HelpMessage = "Enter the task ID", + ParameterSetName = "ID" + )] + [int32]$ID, + + [datetime]$CompletedDate = $(Get-Date), + [switch]$Archive, [switch]$Passthru @@ -803,11 +820,23 @@ Function Complete-MyTask { Return } } + elseif ($ID) { + #get the task + Try { + Write-Verbose "[PROCESS] Retrieving task ID: $ID" + $Task = Get-MyTask -ID $ID -ErrorAction Stop + } + Catch { + Write-Error $_ + #bail out + Return + } + } If ($Task) { Write-Verbose "[PROCESS] Marking task as completed" #invoke CompleteTask() method - $task.CompleteTask() + $task.CompleteTask($CompletedDate) Write-Verbose "[PROCESS] $($task | Select-Object *,Completed,TaskModified,TaskID | Out-String)" #find matching XML node and replace it diff --git a/README.md b/README.md index 23272a9..bcde6ac 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This PowerShell module is designed as a task or simple To-Do manager. The module Task data is stored in an XML file in the user's Documents folder. Here are a few highlights. ## Class based ## -This module requires PowerShell version 5.0 since is uses a class definition for the task object. While you could use the object's properties and methods directly, you should use the appropriate module command. +This module requires at least PowerShell version 5.0 since is uses a class definition for the task object. While you could use the object's properties and methods directly, you should use the appropriate module command. ## Categories ## The Task object includes a Category property. The module will define a default set of categories, but users can create their own by using the MyTaskCategory commands: @@ -16,6 +16,9 @@ The Task object includes a Category property. The module will define a default s + Get-MyTaskCategory + Remove-MyTaskCategory +## Format Views +The module includes a format.ps1xml file that defines a default display when you run `Get-MyTask`. You will get a slightly different set of properties when you run `Get-MyTask | Format-List`. There is also a custom table view called Category which will create a table grouped by the Category property. You should sort the tasks first: `Get-MyTask | Sort-Object Category | Format-Table -view category`. + ## Colorized Output ## Normally, you will use `Get-MyTask` to display tasks, all, some or a single item: @@ -24,7 +27,7 @@ PS S:\> get-mytask -name MemoryTools ID Name Description DueDate OverDue Category Progress -- ---- ----------- ------- ------- -------- -------- -8 MemoryTools update module ```7/22/2018 False Projects 10 +8 MemoryTools update module 7/22/2018 False Projects 10 ``` But there is also a command called `Show-MyTask` which will write output directly to the host. Incomplete tasks that are overdue will be displayed in red text. Tasks that will be due in 24 hours will be displayed in yellow. If you select all tasks then completed items will be displayed in green. This command may not work in the PowerShell ISE. @@ -49,4 +52,4 @@ You should read full help and examples for all commands as well as the about_MyT Please post any issues, questions or feature requests in the [Issues](https://github.com/jdhitsolutions/MyTasks/issues) section. -*last updated 3 January 2018* \ No newline at end of file +*last updated 9 January 2018* \ No newline at end of file diff --git a/Tests/MyTasks.tests.ps1 b/Tests/MyTasks.tests.ps1 index b200d71..272aefe 100644 --- a/Tests/MyTasks.tests.ps1 +++ b/Tests/MyTasks.tests.ps1 @@ -10,12 +10,12 @@ $theModule = get-module -name mytasks $theModule.exportedfunctions.count | should be 11 } - It "Should have 7 aliases command" { - $theModule.ExportedAliases.count | should be 7 + It "Should have 8 aliases command" { + $theModule.ExportedAliases.count | should be 8 } - It "Should export 3 variables by default" { - $theModule.ExportedVariables.Count | Should be 3 + It "Should export 4 variables by default" { + $theModule.ExportedVariables.Count | Should be 4 } It "Should have a formatting xml file" { @@ -74,13 +74,13 @@ Describe Tasks { #need absolute path for XML files new-Item -Name Documents -ItemType Directory -path $TestDrive $home = $TestDrive +$mytaskhome = "$home\Documents" $mytaskPath = Join-Path $home\Documents -child "myTasks.xml" $myTaskArchivePath = Join-Path -Path $home\Documents -ChildPath "myTasksArchive.xml" $myTaskCategory = Join-Path -path $home\Documents -childpath "myTaskCategory.txt" Add-MyTaskCategory -Category Work,Personal,Other,Training,Testing - It "Should create a new task" { $a = New-MyTask -Name Test1 -DueDate $Due -Category Testing -Passthru $a.id | Should be 1 @@ -144,17 +144,13 @@ Add-MyTaskCategory -Category Work,Personal,Other,Training,Testing } It "Should Complete a task" { - {Complete-Mytask -Name Test1 -ErrorAction Stop} | Should Not Throw - (Get-MyTask | Measure-Object).Count | Should be 4 (Get-MyTask -Completed | Measure-Object).Count | Should be 1 - } It "Should complete and archive a task" { - {Complete-Mytask -Name Test2 -Archive -ErrorAction Stop} | Should Not Throw - (Get-MyTask).count | Should be 3 + (Get-MyTask -all | where-object {-not $_.completed}).count | Should be 3 } It "Should archive or save a task" { @@ -162,7 +158,7 @@ Add-MyTaskCategory -Category Work,Personal,Other,Training,Testing Get-MyTask -Completed | Save-MyTask -Path $save Test-Path $save | should Be $True Get-MyTask -Name Test1 | Should Be $null - (Get-MyTask).count | Should be 3 + (Get-MyTask -all).count | Should be 3 } It "Should have an Archive-MyTask alias for Save-MyTask" { @@ -172,14 +168,15 @@ Add-MyTaskCategory -Category Work,Personal,Other,Training,Testing } It "Should remove a task and backup the task file" { - - # Mock Get-Date { return "20171001" } -ParameterFilter {$format -eq "yyyyMMdd"} {Remove-myTask -Name Alice } | Should not Throw {Get-MyTask -Name Bob | Remove-MyTask } | should not Throw - (Get-MyTask).count | Should be 1 - # dir $TestDrive -Recurse | out-string | write-host + (Get-MyTask -all).count | Should be 1 + } + + It "Should backup the task file" { + {Backup-MyTaskFile -ErrorAction Stop} | Should Not Throw + #dir $TestDrive -Recurse | out-string | write-host Test-Path $TestDrive\documents\MyTasks_Backup_*.xml | Should be $True - } } #describe my tasks diff --git a/changelog.txt b/changelog.txt index e25cc22..1c2e8b4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,15 @@ Changelog for MyTasks +v1.3.0 +Updated README +Added 'task' as an alias for New-MyTask +Added CompletedDate parameter to Complete-MyTask (Issue #13) +Added option to complete a task by ID (Issue #11) +Changed default for Get-MyTask and Show-MyTask to display tasks due in next 30 days. (Issue #12) +fixed bug in Show-Mytask where completed tasks were displaying in red +Made parameters for New-MyTask more positional (Issue #14) +Updated help documentation + v1.2.0 Modified files to support PowerShell Core Update help documentation diff --git a/docs/Add-MyTaskCategory.md b/docs/Add-MyTaskCategory.md index e7e535a..41ffd0f 100644 --- a/docs/Add-MyTaskCategory.md +++ b/docs/Add-MyTaskCategory.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -21,14 +21,14 @@ By default the MyTasks module ships with default categories of Work, Personal, C ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> Add-MyTaskCategory -Category Training ``` Add a Training category. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> Add-MyTaskCategory -Category Other,Work,Personal,Team PS C:\> Get-MyTaskCategory @@ -50,7 +50,7 @@ Enter a new task category. ```yaml Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -101,6 +101,7 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/ ## RELATED LINKS + [Get-MyTaskCategory]() [Remove-MyTaskCategory]() diff --git a/docs/Backup-MyTaskFile.md b/docs/Backup-MyTaskFile.md index e4cef1c..b8892e8 100644 --- a/docs/Backup-MyTaskFile.md +++ b/docs/Backup-MyTaskFile.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -17,11 +17,11 @@ Backup-MyTaskFile [[-Destination] ] [-Passthru] [-WhatIf] [-Confirm] [ backup-mytaskfile -Passthru @@ -36,9 +36,9 @@ Mode LastWriteTime Length Name Create a backup copy of the source XML file to the default location, -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` -PS C:\> Backup-MyTaskFile -Destination c:\work\taskback.xm +PS C:\> Backup-MyTaskFile -Destination c:\work\taskback.xml ``` Create a backup copy of the source XML file to specified file. @@ -51,7 +51,7 @@ Enter the filename and path for the backup xml file. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: 0 @@ -64,7 +64,7 @@ Accept wildcard characters: False ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named diff --git a/docs/Complete-MyTask.md b/docs/Complete-MyTask.md index 91a50a9..3bf825d 100644 --- a/docs/Complete-MyTask.md +++ b/docs/Complete-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -14,12 +14,20 @@ Mark a MyTask item as completed. ### Name (Default) ``` -Complete-MyTask [-Name] [-Archive] [-Passthru] [-WhatIf] [-Confirm] [] +Complete-MyTask [-Name] [-CompletedDate ] [-Archive] [-Passthru] [-WhatIf] [-Confirm] + [] ``` ### Task ``` -Complete-MyTask [-Task ] [-Archive] [-Passthru] [-WhatIf] [-Confirm] [] +Complete-MyTask [-Task ] [-CompletedDate ] [-Archive] [-Passthru] [-WhatIf] [-Confirm] + [] +``` + +### ID +``` +Complete-MyTask -ID [-CompletedDate ] [-Archive] [-Passthru] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -27,7 +35,7 @@ Use this command to mark a MyTask work item as completed. This will automaticall ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> get-mytask -id 6 | Complete-MyTask -Passthru @@ -38,13 +46,20 @@ ID Name Description DueDate OverDue Category Get MyTask with an ID of 6 and mark it as complete. By default nothing is written to the pipeline unless you use -Passthru. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> Complete-MyTask -Name "setup CEO laptop" -archive ``` Mark the task as completed and archive it to the myTasksArchive.xml file. +### EXAMPLE 3 +``` +PS C:\> Complete-MyTask -Name "update-resume" -CompletedDate "4/1/2017 4:00PM" +``` + +Mark the task as completed using the specified date. + ## PARAMETERS ### -Archive @@ -53,7 +68,7 @@ Move the task to the default archive file. There is no provision for specifying ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -68,7 +83,7 @@ Enter the name of a task. ```yaml Type: String Parameter Sets: Name -Aliases: +Aliases: Required: True Position: 0 @@ -82,7 +97,7 @@ Accept wildcard characters: False ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -97,7 +112,7 @@ A MyTask item. ```yaml Type: MyTask Parameter Sets: Task -Aliases: +Aliases: Required: False Position: Named @@ -132,6 +147,34 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CompletedDate +The date you completed the task. The default is the now. + +```yaml +Type: DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ID +Enter the task ID```yaml +Type: Int32 +Parameter Sets: ID +Aliases: + +Required: True +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). diff --git a/docs/Get-MyTask.md b/docs/Get-MyTask.md index 9901a20..1a407b1 100644 --- a/docs/Get-MyTask.md +++ b/docs/Get-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -12,7 +12,12 @@ Get MyTask work items. ## SYNTAX -### Name (Default) +### Days (Default) +``` +Get-MyTask [-DaysDue ] [] +``` + +### Name ``` Get-MyTask [[-Name] ] [] ``` @@ -32,24 +37,19 @@ Get-MyTask [-All] [] Get-MyTask [-Completed] [] ``` -### Days -``` -Get-MyTask [-DaysDue ] [] -``` - ### Category ``` Get-MyTask [-Category ] [] ``` ## DESCRIPTION -This command reads MyTask items from the source XML file and creates a list of MyTask objects. The default behavior is to display all uncompleted tasks for all categories. But you can limit the results through different parameters. +This command reads MyTask items from the source XML file and creates a list of MyTask objects. The default behavior is to display uncompleted tasks for all categories due in the next 30 days. But you can limit the results through different parameters. Note that the the ID property will be assigned to all tasks in the source XML file, so depending on what parameters you use, you probably won't see a consecutive list of ID numbers. ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> Get-MyTask @@ -57,15 +57,11 @@ ID Name Description DueDate OverDue Category -- ---- ----------- ------- ------- -------- -------- 2 Order books Month of Lunches 8/1/2017 True Personal 0 4 Apache Install Ubuntu 16 9/13/2017 False work 10 -5 2018 Training Budget 10/1/2017 False Personal 0 -6 Conferences 10/7/2017 False other 0 -7 Update Server03 10/14/2017 False work 0 -8 Finish DSC Training 12/31/2017 False Personal 80 ``` -Get all active tasks. +Get active tasks due in the next 30 days. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> Get-MyTask -all @@ -83,7 +79,7 @@ ID Name Description DueDate OverDue Category Get all tasks including completed. -### -------------------------- EXAMPLE 3 -------------------------- +### EXAMPLE 3 ``` PS C:\>get-mytask -Category work @@ -95,9 +91,9 @@ ID Name Description DueDate OverDue Category Get all active tasks in the Work category. -### -------------------------- EXAMPLE 4 -------------------------- +### EXAMPLE 4 ``` -PS C:\> get-mytask -daysdue 30 +PS C:\> get-mytask -daysdue 90 ID Name Description DueDate OverDue Category Progress -- ---- ----------- ------- ------- -------- -------- @@ -105,9 +101,9 @@ ID Name Description DueDate OverDue Category 4 Apache Install Ubuntu 16 9/13/2017 False work 10 ``` -Get all active tasks due in the next 30 days +Get all active tasks due in the next 90 days -### -------------------------- EXAMPLE 5 -------------------------- +### EXAMPLE 5 ``` PS C:\> get-mytask -id 4 | format-list -View all @@ -135,7 +131,7 @@ Display all tasks fronm the source XML file ```yaml Type: SwitchParameter Parameter Sets: All -Aliases: +Aliases: Required: False Position: Named @@ -150,7 +146,7 @@ Display active tasks from the specified category. ```yaml Type: String Parameter Sets: Category -Aliases: +Aliases: Accepted values: your defined categories Required: False @@ -166,7 +162,7 @@ Display only completed tasks from the source XML file ```yaml Type: SwitchParameter Parameter Sets: Completed -Aliases: +Aliases: Required: False Position: Named @@ -181,11 +177,11 @@ Display active tasks due in the next specified number of days ```yaml Type: Int32 Parameter Sets: Days -Aliases: +Aliases: Required: False Position: Named -Default value: None +Default value: 30 Accept pipeline input: False Accept wildcard characters: False ``` @@ -196,7 +192,7 @@ Display a given task by its ID number. ```yaml Type: Int32 Parameter Sets: ID -Aliases: +Aliases: Required: False Position: Named @@ -210,7 +206,7 @@ The name of a given task. ```yaml Type: String Parameter Sets: Name -Aliases: +Aliases: Required: False Position: 0 diff --git a/docs/Get-MyTaskCategory.md b/docs/Get-MyTaskCategory.md index 1b3b452..4e7a510 100644 --- a/docs/Get-MyTaskCategory.md +++ b/docs/Get-MyTaskCategory.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -21,7 +21,7 @@ Use this command to display all of the current categories for the MyTasks module ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> Get-MyTaskCategory Work diff --git a/docs/New-MyTask.md b/docs/New-MyTask.md index fe731ec..4d7c0d9 100644 --- a/docs/New-MyTask.md +++ b/docs/New-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -31,7 +31,7 @@ The command will not write anything to the pipeline unless you use -Passthru. If ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> New-MyTask -Name "Finish DSC Training" -days 30 -Category Personal -Passthru @@ -42,6 +42,12 @@ ID Name Description DueDate OverDue Category Create a new task using the Training category that is due 30 days from now. +### EXAMPLE 2 +``` +PS C:\> task reboot-router "1/18/2018 5:00PM" other +``` + +Create a task using the alias and positional parameters for the task name, due date and category. ## PARAMETERS ### -Category @@ -49,7 +55,7 @@ A task category. The Get-MyTaskCategory command should display all available cat ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Accepted values: your defined categories Required: True @@ -65,7 +71,7 @@ The deadline for the task set this number of days from now. ```yaml Type: Int32 Parameter Sets: Days -Aliases: +Aliases: Required: False Position: Named @@ -80,7 +86,7 @@ Additional information or a brief description for your task. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -95,7 +101,7 @@ When you task is due to be completed. ```yaml Type: DateTime Parameter Sets: Date -Aliases: +Aliases: Required: False Position: Named @@ -110,7 +116,7 @@ Enter the name of your task. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -123,7 +129,7 @@ Accept wildcard characters: False ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named diff --git a/docs/Remove-MyTask.md b/docs/Remove-MyTask.md index 8f88c9d..c54d85c 100644 --- a/docs/Remove-MyTask.md +++ b/docs/Remove-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -29,7 +29,7 @@ As an alternative to deleting tasks you can also archive them. ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> remove-mytask -Name "Finish DSC Training" -whatif What if: Performing the operation "Copy File" on target "Item: C:\Users\Jeff\Documents\myTasks.xml Destination: C:\Users @@ -39,7 +39,7 @@ What if: Performing the operation "Remove-MyTask" on target "2f252083-3c8e-4823- The command supports Whatif. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> Get-myTask -Name "Finish DSC Training" | Remove-MyTask ``` @@ -53,7 +53,7 @@ A myTask object from Get-MyTask ```yaml Type: MyTask Parameter Sets: Object -Aliases: +Aliases: Required: True Position: Named @@ -68,7 +68,7 @@ Enter task name ```yaml Type: String Parameter Sets: Name -Aliases: +Aliases: Required: True Position: 0 diff --git a/docs/Remove-MyTaskCategory.md b/docs/Remove-MyTaskCategory.md index 87471e7..68393f7 100644 --- a/docs/Remove-MyTaskCategory.md +++ b/docs/Remove-MyTaskCategory.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -21,7 +21,7 @@ If you have created custom MyTask categories with Add-MyTaskCategory, and wish t ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> Remove-MyTaskCategory ProjectX ``` @@ -36,7 +36,7 @@ Enter a task category name to remove. ```yaml Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -89,4 +89,5 @@ http://jdhitsolutions.com/blog/essential-powershell-resources/ ## RELATED LINKS [Get-MyTaskCategory]() + [Add-MyTaskCategory]() diff --git a/docs/Save-MyTask.md b/docs/Save-MyTask.md index 36b014c..39ff820 100644 --- a/docs/Save-MyTask.md +++ b/docs/Save-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -27,14 +27,14 @@ Note: Currently there are no commands in this module for working with the archiv ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> archive-mytask ``` Uaing the alias, archive all completed tasks to myTaskArchive.xml. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> get-mytask -Category other | save-mytask -Path c:\work\myOther.xml -Passthru @@ -55,7 +55,7 @@ Get all tasks in the Other category and save them to a new file. The tasks will ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -70,7 +70,7 @@ The path to a new XML file. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: 0 @@ -85,7 +85,7 @@ A MyTask object. ```yaml Type: MyTask[] Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named diff --git a/docs/Set-MyTask.md b/docs/Set-MyTask.md index 66fca9c..b817ce1 100644 --- a/docs/Set-MyTask.md +++ b/docs/Set-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -37,7 +37,7 @@ Use Complete-MyTask to mark an item as completed. ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> PS S:\> Set-MyTask -Name "Finish DSC Training" -Progress 70 -duedate "12/31/2017" -Passthru @@ -48,7 +48,7 @@ ID Name Description DueDate OverDue Category Set the progress value and a new due date for the 'Finish DSC Training' task. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> get-mytask -ID 9 | set-mytask -Progress 10 -Category Projects ``` @@ -63,7 +63,7 @@ Set the task category. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Accepted values: your defined categories Required: False @@ -79,7 +79,7 @@ Set the comment or description for the task. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -94,7 +94,7 @@ Set when the task is due for completion. ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -109,7 +109,7 @@ Enter the task ID to identify task you wish to modify. ```yaml Type: Int32 Parameter Sets: ID -Aliases: +Aliases: Required: False Position: Named @@ -124,7 +124,7 @@ Enter the name of a task to modify. ```yaml Type: String Parameter Sets: Name -Aliases: +Aliases: Required: True Position: 0 @@ -139,7 +139,7 @@ Give the task a new name. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -152,7 +152,7 @@ Accept wildcard characters: False ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -167,7 +167,7 @@ Set a progress completion value between 0 and 100. ```yaml Type: Int32 Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -182,7 +182,7 @@ A task object usually piped from Get-MyTask. ```yaml Type: MyTask Parameter Sets: Task -Aliases: +Aliases: Required: False Position: Named diff --git a/docs/Show-MyTask.md b/docs/Show-MyTask.md index a951b3c..a2475a2 100644 --- a/docs/Show-MyTask.md +++ b/docs/Show-MyTask.md @@ -1,7 +1,7 @@ --- external help file: MyTasks-help.xml Module Name: MyTasks -online version: +online version: schema: 2.0.0 --- @@ -12,9 +12,9 @@ Display all active tasks with color highlights. ## SYNTAX -### none (Default) +### Days (Default) ``` -Show-MyTask [] +Show-MyTask [-DaysDue ] [] ``` ### all @@ -32,14 +32,14 @@ This command is very similar to Get-MyTask in terms of what it displays. However ## EXAMPLES -### -------------------------- EXAMPLE 1 -------------------------- +### EXAMPLE 1 ``` PS C:\> Show-MyTask ``` -You will get a colorized output of Get-MyTask. +You will get a colorized output of Get-MyTask for tasks due in the next 30 days. -### -------------------------- EXAMPLE 2 -------------------------- +### EXAMPLE 2 ``` PS C:\> Show-MyTask -category Work ``` @@ -54,7 +54,7 @@ Display all tasks including those that are completed. ```yaml Type: SwitchParameter Parameter Sets: all -Aliases: +Aliases: Required: False Position: Named @@ -69,7 +69,7 @@ Display all tasks that belong to the specified category. ```yaml Type: String Parameter Sets: Category -Aliases: +Aliases: Accepted values: your defined categories Required: False @@ -79,6 +79,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DaysDue +Get tasks due in this number of days. This is the default behavior. + +```yaml +Type: Int32 +Parameter Sets: Days +Aliases: + +Required: False +Position: Named +Default value: 30 +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). diff --git a/docs/about_MyTasks.md b/docs/about_MyTasks.md index bdfb755..f7621a5 100644 --- a/docs/about_MyTasks.md +++ b/docs/about_MyTasks.md @@ -44,7 +44,6 @@ into the PowerShell session. These numbers might change in the same way that job numbers change from session to session. The hidden TaskID is the unique id for each task. - ## Design All task information is stored in an XML file which is created in the user's documents folder. On Linux with PowerShell Core the $home folder will be used. diff --git a/en-US/MyTasks-help.xml b/en-US/MyTasks-help.xml index aea1388..d4e693d 100644 --- a/en-US/MyTasks-help.xml +++ b/en-US/MyTasks-help.xml @@ -158,7 +158,7 @@ Team - Use this command to create a backup copy of the source XML file. The default behavior is to create an XML file in your Documents directory with the format MyTasks_Backup_YYYYMMDD.xml. You can also specify an alternate filename. + Use this command to create a backup copy of the source XML file. The default behavior is to create an XML file in your Documents or Home directory with the format MyTasks_Backup_YYYYMMDD.xml. You can also specify an alternate filename. @@ -303,7 +303,7 @@ Mode LastWriteTime Length Name -------------------------- EXAMPLE 2 -------------------------- - PS C:\> Backup-MyTaskFile -Destination c:\work\taskback.xm + PS C:\> Backup-MyTaskFile -Destination c:\work\taskback.xml Create a backup copy of the source XML file to specified file. @@ -387,6 +387,18 @@ Mode LastWriteTime Length Name False + + CompletedDate + + The date you completed the task. The default is the now. + + DateTime + + DateTime + + + None + Complete-MyTask @@ -446,6 +458,89 @@ Mode LastWriteTime Length Name False + + CompletedDate + + The date you completed the task. The default is the now. + + DateTime + + DateTime + + + None + + + + Complete-MyTask + + Archive + + Move the task to the default archive file. There is no provision for specifying an alternate file. + + + SwitchParameter + + + False + + + Passthru + + + + + SwitchParameter + + + False + + + Confirm + + + + + SwitchParameter + + + False + + + WhatIf + + + + + SwitchParameter + + + False + + + CompletedDate + + The date you completed the task. The default is the now. + + DateTime + + DateTime + + + None + + + ID + + Enter the task ID + + Int32 + + Int32 + + + None + @@ -521,6 +616,30 @@ Mode LastWriteTime Length Name False + + CompletedDate + + The date you completed the task. The default is the now. + + DateTime + + DateTime + + + None + + + ID + + Enter the task ID + + Int32 + + Int32 + + + None + @@ -566,6 +685,13 @@ ID Name Description DueDate OverDue Category Mark the task as completed and archive it to the myTasksArchive.xml file. + + -------------------------- EXAMPLE 3 -------------------------- + PS C:\> Complete-MyTask -Name "update-resume" -CompletedDate "4/1/2017 4:00PM" + + Mark the task as completed using the specified date. + + @@ -588,7 +714,7 @@ ID Name Description DueDate OverDue Category - This command reads MyTask items from the source XML file and creates a list of MyTask objects. The default behavior is to display all uncompleted tasks for all categories. But you can limit the results through different parameters. + This command reads MyTask items from the source XML file and creates a list of MyTask objects. The default behavior is to display uncompleted tasks for all categories due in the next 30 days. But you can limit the results through different parameters. Note that the the ID property will be assigned to all tasks in the source XML file, so depending on what parameters you use, you probably won't see a consecutive list of ID numbers. @@ -650,7 +776,7 @@ ID Name Description DueDate OverDue Category Int32 - None + 30 @@ -731,7 +857,7 @@ ID Name Description DueDate OverDue Category Int32 - None + 30 ID @@ -791,13 +917,9 @@ ID Name Description DueDate OverDue Category ID Name Description DueDate OverDue Category Progress -- ---- ----------- ------- ------- -------- -------- 2 Order books Month of Lunches 8/1/2017 True Personal 0 -4 Apache Install Ubuntu 16 9/13/2017 False work 10 -5 2018 Training Budget 10/1/2017 False Personal 0 -6 Conferences 10/7/2017 False other 0 -7 Update Server03 10/14/2017 False work 0 -8 Finish DSC Training 12/31/2017 False Personal 80 +4 Apache Install Ubuntu 16 9/13/2017 False work 10 - Get all active tasks. + Get active tasks due in the next 30 days. @@ -832,14 +954,14 @@ ID Name Description DueDate OverDue Category -------------------------- EXAMPLE 4 -------------------------- - PS C:\> get-mytask -daysdue 30 + PS C:\> get-mytask -daysdue 90 ID Name Description DueDate OverDue Category Progress -- ---- ----------- ------- ------- -------- -------- 2 Order books Month of Lunches 8/1/2017 True Personal 0 4 Apache Install Ubuntu 16 9/13/2017 False work 10 - Get all active tasks due in the next 30 days + Get all active tasks due in the next 90 days @@ -1273,6 +1395,13 @@ ID Name Description DueDate OverDue Category Create a new task using the Training category that is due 30 days from now. + + -------------------------- EXAMPLE 2 -------------------------- + PS C:\> task reboot-router "1/18/2018 5:00PM" other + + Create a task using the alias and positional parameters for the task name, due date and category. + + @@ -2419,6 +2548,21 @@ ID Name Description DueDate OverDue Category None + + Show-MyTask + + DaysDue + + Get tasks due in this number of days. This is the default behavior. + + Int32 + + Int32 + + + 30 + + @@ -2445,6 +2589,18 @@ ID Name Description DueDate OverDue Category None + + DaysDue + + Get tasks due in this number of days. This is the default behavior. + + Int32 + + Int32 + + + 30 + @@ -2476,7 +2632,7 @@ ID Name Description DueDate OverDue Category -------------------------- EXAMPLE 1 -------------------------- PS C:\> Show-MyTask - You will get a colorized output of Get-MyTask. + You will get a colorized output of Get-MyTask for tasks due in the next 30 days. diff --git a/en-US/about_mytasks.help.txt b/en-US/about_mytasks.help.txt index ca69caf..ff416c9 100644 --- a/en-US/about_mytasks.help.txt +++ b/en-US/about_mytasks.help.txt @@ -2,7 +2,6 @@ about_mytasks - SHORT DESCRIPTION The commands in the module are intended to be used as a simple solution for personal project management or as a more extensive To-Do list. The goal is @@ -52,7 +51,7 @@ Design used. This path is stored as a global variable myTaskPath and will have a value like: C:\Users\Jeff\Documents\myTasks.xml. There is also an XML file for archiving completed tasks. This too is in the Documents or $home folder - and can be referenced via the myTaskArchivePath variable. + and can be referenced via the myTaskArchivePath variable. As tasks are created, modified, completed and archived, these XML files are updated. Select-XML is used extensively to make this process as efficient