Skip to content

Instantly share code, notes, and snippets.

View vScripter's full-sized avatar
👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
## 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
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"
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'
function Get-WorkLog {
[cmdletbinding()]
param (
[parameter(Mandatory = $false)]
[System.String]$Path = "$ENV:USERPROFILE\Documents\GitHub\WorkLog"
)
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
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 {
function Add-WorkLog {
[cmdletbinding()]
param (
[parameter(Mandatory = $true,
Position = 0)]
[System.String]$Message,
[parameter(Mandatory = $false,
Position = 1)]
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'
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
function New-WorkLog {
[cmdletbinding()]
param (
[parameter(Mandatory = $false)]
[System.String]$Path = "$ENV:USERPROFILE\Documents\GitHub\WorkLog"
)