MyTasks.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#requires -version 5.0

#region variables

#path to user defined categories
if ($isLinux) {
    $mytaskhome = $home
}
else {
    $mytaskhome = "$home\Documents" 
}
$myTaskCategory = Join-Path -Path $mytaskhome -ChildPath myTaskCategory.txt

#path to stored tasks
$mytaskPath = Join-Path -Path $mytaskhome -ChildPath myTasks.xml

#path to archived or completed tasks
$myTaskArchivePath = Join-Path -Path $mytaskhome -ChildPath myTasksArchive.xml

#default task categories
$myTaskDefaultCategories = "Work","Personal","Other","Customer"

#endregion

#dot source functions
. $psscriptroot\MyTasksFunctions.ps1

#define some aliases
$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 = @{
Variable = "myTaskPath","myTaskDefaultCategories","myTaskArchivePath","mytaskhome"
Function = "New-MyTask","Set-MyTask","Remove-MyTask","Get-MyTask",
"Show-MyTask","Complete-MyTask","Get-MyTaskCategory","Add-MyTaskCategory",
"Remove-MyTaskCategory","Backup-MyTaskFile","Save-MyTask"
Alias = $aliases.Name
}

#exported via manifest
Export-ModuleMember @exportParams