migrate from scripts repo
This commit is contained in:
46
uash.ua
Executable file
46
uash.ua
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env uiua
|
||||
|
||||
┌─╴CommandLine
|
||||
# "~/..." ? cwd
|
||||
Pretty ↚ ⊂@~▽⊸⬚@\0≠&var"HOME"
|
||||
|
||||
COLORS ↚ map ⊙≡°□ ≡°⊟ [
|
||||
{"red" 1} {"green" 2} {"yellow" 3} {"blue" 4}
|
||||
]
|
||||
ColorCode ↚ ˜⊂"\x1b[0m" ⊂$"\x1b[1;3_m"
|
||||
C ↚ (
|
||||
⨂{"truecolor"} □&var"COLORTERM"
|
||||
⨬(ColorCode get ⊙COLORS
|
||||
| ◌
|
||||
)
|
||||
)
|
||||
|
||||
PS₁ ← &pf comptime(˜⊂ C"green" " λ " C"blue" Pretty °&cd)
|
||||
└─╴
|
||||
|
||||
┌─╴Commands
|
||||
# ? {"cd" ...}
|
||||
CD ← (
|
||||
⨂[0 1]⊸⧻ ↘1
|
||||
⨬(&cd&var"HOME"
|
||||
| ⍣&cd(&ep"cd: invalid path") ⊢
|
||||
| &ep"cd: too many arguments")
|
||||
)
|
||||
|
||||
Otherwise ← (
|
||||
⍣(°0&runi|&ep⊂"failed to run " /◇$"_ _")
|
||||
)
|
||||
└─╴
|
||||
|
||||
┌─╴Main
|
||||
F ← |1.0 (
|
||||
⊜□⊸≠@\s
|
||||
⨂{"cd"}⊸⍣⊢""
|
||||
⨬(Commands~CD
|
||||
| Commands~Otherwise)
|
||||
CommandLine~PS₁
|
||||
)
|
||||
|
||||
CommandLine~PS₁
|
||||
&rlF 0
|
||||
└─╴
|
||||
Reference in New Issue
Block a user