Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bashmoji

Emoji and colour for bash scripts, safe to source.

Made for, and used by, the DeltaVerse installer.

source ./bashmoji.sh
bm_step 1 3 "installing"
bm_ok   "done"
bm_warn "the lockfile is pnpm's"
bm_die  "node >= 22.13 is required"
echo "$BM_ROCKET launched  ·  $(bm_link https://deltaverse.pythai.net DeltaVerse)"

Run ./bashmoji.sh to see every glyph, colour and helper. Run ./bashmoji.sh --plain to see the ASCII fallback.

Files

file what it is
bashmoji.sh The library (v2). Prefixed BM_* glyphs and colours plus bm_* helpers. Colour is detected automatically, and the emoji fall back to ASCII. Use this in new scripts.
shellmoji.sh The original catalogue under its unprefixed names ($CHECK, $ROCKET, $BITCOIN, …): 290+ names, one definition each.
colorbash.sh The full colour palette: 16-colour, 256-colour, true-colour, backgrounds and formatting, plus the print_* helpers.
test.sh Proves each file is safe to source. Run it before you push.

Why "safe to source" matters

A file you source runs inside your script's own shell, so every assignment in it becomes your variable. The first version of this catalogue had two assignments that broke any script that sourced it:

  • PATH="🛣️" replaced the command search path, so no later command could be found.
  • PORT="🚪" overwrote the variable that servers read their listen port from.

Two stray text lines (fix this, -----) also ran as commands, and colorbash.sh printed its demo into every script that loaded it. All of that is fixed:

  • Prefixed names. bashmoji.sh uses only BM_* and bm_* names, so it cannot collide with yours.
  • Renamed collisions. In shellmoji.sh, PATH is now ROUTE and PORT is now DOOR. Every other name keeps the exact value it had before. Where the old file assigned a name twice, the last value (the one that took effect) is the one kept.
  • Silent when sourced. None of the files prints anything or runs anything when sourced. The demos run only when you execute a file directly.

Degrades by itself

condition effect
stdout is not a terminal (piped, logged, CI) no colour codes
NO_COLOR is set (no-color.org) or TERM=dumb no colour codes
the locale is not UTF-8, or BASHMOJI=plain ASCII glyphs ([ok], [x], [!])
BASHMOJI_COLOR=always / COLORBASH=always forces colour on
BASHMOJI=emoji forces emoji on

Compatible with bash 3.2 (the macOS default) and later: no associative arrays and no ${x,,}.

Vendoring

Copy bashmoji.sh into your project rather than fetching it at run time. It is a single file with no dependencies. The DeltaVerse keeps a local copy at scripts/lib/bashmoji.sh, and its installer loads it from there.


DeltaVerse · codephreak · cryptoAGI

About

Emoji + colour for bash scripts, safe to source — used by the DeltaVerse installer (deltaverse.pythai.net)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages