Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobianco committed Jan 4, 2025
1 parent e10797a commit a8848a2
Show file tree
Hide file tree
Showing 11 changed files with 940 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
-include .env
export $(shell test -f .env && cut -d= -f1 .env)

## ===========
## Development
## ===========

push:
@git add .
@git commit -am "Update"
@git push

## ======
## Remote
## ======
Expand Down
18 changes: 17 additions & 1 deletion app/mush.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
set -e

curl -s https://get.javanile.org/install | bash -s mush 0.1.1
## Install latest stable version
curl -s https://get.javanile.org/install | bash -s mush 0.2.0

## Override with development branch
if [ "$1" = "--branch" ] && [ -n "$2" ]; then
git_uri=https://github.com/javanile/mush.git
src_dir=$HOME/.mush/registry/src/https-github-com-javanile-mush/mush

mush install console
mkdir -p "${src_dir}"
git clone --single-branch --branch "$2" "${git_uri}" "${src_dir}/$2"
cd "${src_dir}/$2"
mush build --release
cp bin/mush ${HOME}/.mush/bin/mush
${HOME}/.mush/bin/mush --version
fi

45 changes: 45 additions & 0 deletions lib/code_dumper
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2025-01-04T10:35:08Z
set -e
use() { return 0; }
extern() { return 0; }
legacy() { return 0; }
module() { return 0; }
public() { return 0; }
embed() { return 0; }
## BP004: Compile the entrypoint

code_dumper() {
local file
local line
local keyword
local column
local source
local padding
local keyword_padding
local message
local help

file=$1
line=$2
keyword=$3
message=$4
help=$5
source=$(sed -n "${line}p" "${file}")
column=${source%%$keyword*}
padding=$(echo "$line" | sed 's/[0-9]/ /g')
keyword_padding=$(echo "$column" | sed 's/./ /g')
keyword_size=$(echo "$keyword" | sed 's/./^/g')

echo -e "\e[0m${padding}\e[0m\e[0m\e[1m\e[38;5;12m--> \e[0m\e[0m${file}:${line}:${#column}\e[0m"
echo -e "\e[0m${padding} \e[0m\e[0m\e[1m\e[38;5;12m|\e[0m"
echo -e "\e[0m\e[1m\e[38;5;12m${line}\e[0m\e[0m \e[0m\e[0m\e[1m\e[38;5;12m|\e[0m\e[0m \e[0m\e[0m${source}\e[0m"
echo -e "\e[0m${padding} \e[0m\e[0m\e[1m\e[38;5;12m| ${keyword_padding}\e[0m\e[0m\e[1m\e[38;5;9m${keyword_size}\e[0m\e[0m \e[0m\e[0m\e[1m\e[38;5;9m${message}\e[0m"
if [ -n "${help}" ]; then
echo -e "\e[0m${padding} \e[0m\e[0m\e[1m\e[38;5;12m|\e[0m"
echo -e "\e[0m${padding} \e[0m\e[0m\e[1m\e[38;5;12m= \e[0m\e[1;39mhelp:\e[0m ${help}\e[0m"
fi
echo ""
}
71 changes: 71 additions & 0 deletions lib/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2025-01-04T10:52:11Z
set -e
use() { return 0; }
extern() { return 0; }
legacy() { return 0; }
module() { return 0; }
public() { return 0; }
embed() { return 0; }
## BP004: Compile the entrypoint

# FATAL
# ERROR
# WARNING
# INFO
# DEBUG
# TRACE
# SUCCESS

case "$(uname -s)" in
Darwin*)
ESCAPE='\x1B'
;;
Linux|*)
ESCAPE='\e'
;;
esac

#CONSOLE_INDENT="${ESCAPE}[1;33m{Mush}${ESCAPE}[0m"

console_pad() {
[ "$#" -gt 1 ] && [ -n "$2" ] && printf "%$2.${2#-}s" "$1"
}

console_log() {
console_print "$1" "$2"
}

console_info() {
if [ "${VERBOSE}" -gt "0" ]; then
console_print "${ESCAPE}[1;36m$(console_pad "$1" 12)${ESCAPE}[0m" "$2"
fi
}

console_warning() {
console_print "${ESCAPE}[1;33m$(console_pad "$1" 12)${ESCAPE}[0m" "$2"
}

console_status() {
console_print "${ESCAPE}[1;32m$(console_pad "$1" 12)${ESCAPE}[0m" "$2"
}

console_error() {
echo -e "${ESCAPE}[1;31merror${ESCAPE}[0m: $1" >&2
}

console_error_code() {
echo -e "${ESCAPE}[1;31merror[$1]${ESCAPE}[1;39m: $2${ESCAPE}[0m" >&2
}

console_hint() {
echo -e "${ESCAPE}[1;39m$1${ESCAPE}[0m" >&2
}

console_print() {
if [ -z "${QUIET}" ]; then
echo -e "$1 $2" >&2
fi
}
Loading

0 comments on commit a8848a2

Please sign in to comment.