mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-13 22:38:46 +02:00
Improved list-memos.ps1 and remember.ps1
This commit is contained in:
@ -2,12 +2,12 @@
|
||||
.SYNOPSIS
|
||||
Remembers a text
|
||||
.DESCRIPTION
|
||||
This PowerShell script saves the given text to Memos.csv in your home folder.
|
||||
This PowerShell script saves the given text to 'Remember.csv' in your home folder.
|
||||
.PARAMETER text1
|
||||
Specifies the text to memorize
|
||||
.EXAMPLE
|
||||
PS> ./remember.ps1 "Buy apples"
|
||||
✔️ Saved to /home/Markus/Memos.csv in 0s.
|
||||
✔️ Saved to /home/Markus/Remember.csv in 0s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -20,13 +20,17 @@ try {
|
||||
if ($text1 -eq "") { $text1 = Read-Host "Enter what needs to be remembered" }
|
||||
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
$timestamp = Get-Date -format FileDateTimeUniversal
|
||||
$path = "~/Memos.csv"
|
||||
|
||||
[string]$timestampString = Get-Date -UFormat %s
|
||||
$timestampString = $timestampString -replace ',','.'
|
||||
[int64]$unixTimestamp = $timestampString
|
||||
|
||||
$path = "~/Remember.csv"
|
||||
|
||||
if (-not(Test-Path "$path" -pathType leaf)) {
|
||||
Write-Output "TIME,TEXT" > $path
|
||||
Write-Output "TIMESTAMP,TEXT" > $path
|
||||
}
|
||||
Write-Output "$($timestamp),$text1 $text2 $text3" >> $path
|
||||
Write-Output "$($unixTimestamp),$text1 $text2 $text3" >> $path
|
||||
$path = Resolve-Path $path
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
|
Reference in New Issue
Block a user