PowerShell/Scripts/list-logbook.ps1

29 lines
744 B
PowerShell
Raw Normal View History

2020-12-24 10:44:10 +01:00
#!/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 ""
2020-12-25 11:57:09 +01:00
write-output "Time User Text"
2020-12-24 10:44:10 +01:00
write-output "---------------------------------------------------------------"
foreach($Row in $Table) {
2020-12-25 11:57:09 +01:00
$Time = $Row.Time
$User = $Row.User
2020-12-24 10:44:10 +01:00
$Text = $Row.Text
write-output "$Time ($User) $Text"
}
write-output ""
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}