commit 486dd096f22384be53a25ca2f9aff76723760a63 Author: Fredrik Robertsen Date: Sun Apr 19 01:04:58 2026 +0200 migrate from scripts repo diff --git a/uash.ua b/uash.ua new file mode 100755 index 0000000..3965310 --- /dev/null +++ b/uash.ua @@ -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 +└─╴