This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Work Log | |
### Friday, February 06, 2015 | |
* This is the first item of the day | |
* This is the first sub-item of the day | |
* This is the first sub-sub-item of the day | |
* This is the second item of the day | |
* This is what using back-tick marks through the PowerShell console can be used to ``show code`` in the GFM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-WorkLog 'This is the first item of the day' | |
Add-WorkLog 'This is the first sub-item of the day' -Indent 1 | |
Add-WorkLog 'This is the first sub-sub-item of the day' -Indent 2 | |
Add-WorkLog 'This is the second item of the day' | |
Add-WorkLog "This is how using back-tick marks through the PowerShell console can be used to ````show code```` in the GFM" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCESS { | |
if (Test-Path -LiteralPath $filePath -PathType Leaf) { | |
Get-Content -LiteralPath $filePath -ReadCount 0 | |
} else { | |
Write-Warning -Message 'Work Log file has not been created' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-WorkLog { | |
[cmdletbinding()] | |
param ( | |
[parameter(Mandatory = $false)] | |
[System.String]$Path = "$ENV:USERPROFILE\Documents\GitHub\WorkLog" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCESS { | |
if (Test-Path -LiteralPath $filePath) { | |
if ($Indent) { | |
$indentMessage = $(Add-Indent -Level $Indent) + $Message | |
Write-Verbose -Message 'Adding message to Work Log' | |
Write-Output -InputObject $indentMessage | Out-File $filePath -Append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
$now = Get-Date | |
$dateFormat = $now.tostring('yyyyMMdd') | |
$dateDay = $now.tostring('dddd') | |
$fileName = $dateFormat + '_' + $dateDay + '_' + 'WL.md' | |
$filePath = Join-Path $Path $fileName | |
$nowLong = $now.tostring('D') | |
function Add-Indent { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-WorkLog { | |
[cmdletbinding()] | |
param ( | |
[parameter(Mandatory = $true, | |
Position = 0)] | |
[System.String]$Message, | |
[parameter(Mandatory = $false, | |
Position = 1)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCESS { | |
if (-not (Test-Path -LiteralPath $filePath -PathType Leaf)) { | |
try { | |
Write-Verbose -Message 'Creating worklog file' | |
New-Item -Path $filePath -Type File -ErrorAction 'Stop' | Out-Null | |
Write-Verbose -Message 'Adding message to Work Log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
$now = Get-Date | |
$dateFormat = $now.tostring('yyyyMMdd') | |
$dateDay = $now.tostring('dddd') | |
$fileName = $dateFormat + '_' + $dateDay + '_' + 'WL.md' | |
$filePath = Join-Path $Path $fileName | |
$nowLong = $now.tostring('D') | |
} # end BEGIN block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-WorkLog { | |
[cmdletbinding()] | |
param ( | |
[parameter(Mandatory = $false)] | |
[System.String]$Path = "$ENV:USERPROFILE\Documents\GitHub\WorkLog" | |
) | |