mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-18 08:30:00 +02:00
Updated the manuals
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Script: *list-memos.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script lists all memo entries in Memos.csv in your home folder.
|
||||
This PowerShell script lists all entries in 'Remember.csv' in your home folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -33,9 +33,9 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists your memo entries
|
||||
Lists your remembered entries
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists all memo entries in Memos.csv in your home folder.
|
||||
This PowerShell script lists all entries in 'Remember.csv' in your home folder.
|
||||
.EXAMPLE
|
||||
PS> ./list-memos.ps1
|
||||
.LINK
|
||||
@@ -44,26 +44,23 @@ Script Content
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
|
||||
try {
|
||||
$Path = "~/Memos.csv"
|
||||
if (Test-Path "$Path" -pathType leaf) {
|
||||
write-progress "Reading $Path ..."
|
||||
$Table = Import-CSV "$Path"
|
||||
write-progress -completed "Reading $Path"
|
||||
|
||||
""
|
||||
"Time Text"
|
||||
"---- ----"
|
||||
foreach($Row in $Table) {
|
||||
$Time = $Row.Time
|
||||
$Text = $Row.Text
|
||||
"$Time $Text"
|
||||
}
|
||||
} else {
|
||||
"Sorry, no memos saved yet"
|
||||
$path = "~/Remember.csv"
|
||||
if (-not(Test-Path "$path" -pathType leaf)) {
|
||||
"Nothing to remember."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Progress "Reading $path ..."
|
||||
$table = Import-CSV "$path"
|
||||
Write-Progress -completed "Done."
|
||||
|
||||
foreach($row in $table) {
|
||||
$unixTimestamp = [int64]$row.TIMESTAMP
|
||||
$time = (Get-Date -day 1 -month 1 -year 1970 -hour 0 -minute 0 -second 0).AddSeconds($unixTimestamp)
|
||||
$text = $row.TEXT.trim()
|
||||
"⚠️ NOTE: $text (remembered $time)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@@ -71,4 +68,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of list-memos.ps1 as of 05/19/2024 10:25:22)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of list-memos.ps1 as of 08/15/2024 09:50:49)*
|
||||
|
Reference in New Issue
Block a user