use try/case instead of idx/switch

This commit is contained in:
2026-04-19 09:02:33 +02:00
parent f7cda17924
commit 524cf4d2e7

18
uash.ua
View File

@@ -9,10 +9,8 @@
]
ColorCode ↚ ˜⊂"\x1b[0m" ⊂$"\x1b[1;3_m"
C ↚ (
⨂{"truecolor"} □&var"COLORTERM"
⨬(ColorCode get ⊙COLORS
| ◌
)
⍣(⍩(ColorCode get ⊙COLORS) °"truecolor" &var"COLORTERM"
| ∘)
)
PS₁ ← &pf ⊂(C"blue" Pretty)(°&cd C"green" " λ ")
@@ -21,17 +19,15 @@
┌─╴Commands
# ? {"cd" ...}
CD ← (
⨂[0 1]⊸⧻ ↘1
⨬(&cd&var"HOME"
| ⍣&cd(&ep"cd: invalid path") ⊢
⍣(⍩(&cd&var"HOME") °0⧻↘1
| ⍩(⍣&cd(&ep"cd: invalid path") ⊢) °1⊸⧻↘1
| &ep"cd: too many arguments")
)
# ? {"exit" [code]}
Exit ← (
⨂[0 1]⊸⧻ ↘1
(&exit 0
| &exit ⋕°□⊢
Exit ← |1.0 (
⍣(⍩(&exit 0) °0⧻↘1
| ⍩(&exit ⋕°□⊢) °1⊸⧻↘1
| &ep"exit: too many arguments")
)