#!/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 ˜⊂ 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") ) # ? {"exit" [code]} Exit ← ( ⨂[0 1]⊸⧻ ↘1 ⨬(&exit 0 | &exit ⋕°□⊢ | &ep"exit: too many arguments") ) Otherwise ← ( ⍣(°0&runi|&ep⊂"failed to run " /◇$"_ _") ) └─╴ ┌─╴Main F ← |1.0 ( ⊜□⊸≠@\s ⨂{"cd" "exit"}⊸⍣⊢"" ⨬(Commands~CD | Commands~Exit | Commands~Otherwise) CommandLine~PS₁ ) CommandLine~PS₁ &rlF 0 └─╴