mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Added write-logbook.ps1
This commit is contained in:
28
Scripts/list-logbook.ps1
Executable file
28
Scripts/list-logbook.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./list-logbook.ps1
|
||||
# Description: lists the content of the logbook (../Data/Logbook.csv)
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
||||
try {
|
||||
$PathToRepo=(get-item $MyInvocation.MyCommand.Path).directory.parent
|
||||
|
||||
$Table = import-csv "$PathToRepo/Data/Logbook.csv"
|
||||
|
||||
write-output ""
|
||||
write-output "UTC User Text"
|
||||
write-output "---------------------------------------------------------------"
|
||||
foreach($Row in $Table) {
|
||||
$Time = $Row.UTC
|
||||
$User = $Row.Username
|
||||
$Text = $Row.Text
|
||||
write-output "$Time ($User) $Text"
|
||||
}
|
||||
write-output ""
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./write-logbook.ps1 [<text>]
|
||||
# Description: writes the given text to Data/Logbook.csv
|
||||
# Description: writes the given text to the logbook (../Data/Logbook.csv)
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
Reference in New Issue
Block a user