mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 09:04:18 +01:00
Improve both scripts
This commit is contained in:
parent
6230f7ccc2
commit
3b9c9b68c2
@ -13,12 +13,12 @@ function ListEarthquakes {
|
||||
write-progress "Loading data ..."
|
||||
$Earthquakes = (Invoke-WebRequest -Uri "https://earthquake.usgs.gov/fdsnws/event/1/query?format=$Format&minmagnitude=$MinMagnitude&orderby=$OrderBy" -UserAgent "curl" ).Content | ConvertFrom-CSV
|
||||
foreach ($Quake in $Earthquakes) {
|
||||
new-object PSObject -Property @{ Magnitude=$Quake.mag; Depth=$Quake.depth; Place=$Quake.place; Time=$Quake.time }
|
||||
new-object PSObject -Property @{ Mag=$Quake.mag; Depth=$Quake.depth; Location=$Quake.place; Time=$Quake.time }
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ListEarthquakes | format-table -autoSize -property Magnitude,Depth,Place,Time
|
||||
ListEarthquakes | format-table -property Mag,Location,Depth,Time -autoSize
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -23,7 +23,8 @@ try {
|
||||
"$Time $User $Text"
|
||||
}
|
||||
} else {
|
||||
"Sorry, no $Path file found"
|
||||
"Sorry, no memos saved yet"
|
||||
exit 1
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user