PowerShell/Scripts/list-logbook.ps1

31 lines
800 B
PowerShell
Raw Normal View History

2021-02-09 19:30:45 +01:00
#!/bin/powershell
2020-12-29 15:14:21 +01:00
<#
2021-03-22 20:10:18 +01:00
.SYNTAX ./list-logbook.ps1
.DESCRIPTION lists the content of the logbook (in ../Data/logbook.csv)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
2020-12-29 15:14:21 +01:00
#>
2020-12-24 10:44:10 +01:00
2021-01-02 11:08:59 +01:00
$PathToRepo = "$PSScriptRoot/.."
2020-12-24 10:44:10 +01:00
try {
2020-12-29 15:48:24 +01:00
write-progress "Reading Data/logbook.csv..."
$Table = import-csv "$PathToRepo/Data/logbook.csv"
2021-01-09 12:54:32 +01:00
write-progress -completed "Reading Data/logbook.csv..."
2020-12-24 10:44:10 +01:00
write-output ""
2020-12-25 11:57:09 +01:00
write-output "Time User Text"
2021-02-10 20:48:42 +01:00
write-output "---- ---- ----"
2020-12-24 10:44:10 +01:00
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
2021-02-10 20:48:42 +01:00
write-output "$Time $User $Text"
2020-12-24 10:44:10 +01:00
}
write-output ""
exit 0
} catch {
2021-02-16 10:03:20 +01:00
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
2020-12-24 10:44:10 +01:00
exit 1
}