Skip to content

Commit

Permalink
fix: build.zsh
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
vladdoster committed Dec 4, 2023
1 parent 83f3ea6 commit 1adae07
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions build.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

# According to the Zsh Plugin Standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling
emulate -LR zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops

0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"

(){
emulate -LR zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops

local ZUNIT_BIN="${${0:h}:A}/zunit"

# Clear the file to start with
cat /dev/null > "$ZUNIT_BIN"

# Start with the shebang
echo "#!/usr/bin/env zsh\n" >> "$ZUNIT_BIN"

# Print each of the source files into the target, removing any comments
# and blank lines from the compiled executable
cat ${ZUNIT_BIN:h}/src/**/(^zunit).zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> "$ZUNIT_BIN"

# Print the main command last
cat ${ZUNIT_BIN:h}/src/zunit.zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> "$ZUNIT_BIN"

# Make sure the file is executable
chmod u+x "$ZUNIT_BIN"

# Let the user know we're finished
echo "\033[0;32m==>\033[0;m ZUnit built successfully at \033[0;32m${ZUNIT_BIN}\033[0;m"
} "$@"
local ZUNIT_REPO_DIR="${0:h}"
local ZUNIT_BIN="$ZUNIT_REPO_DIR/zunit"


# Clear the file to start with
cat /dev/null > "$ZUNIT_BIN"

# Start with the shebang
echo "#!/usr/bin/env zsh\n" >> "$ZUNIT_BIN"

# Print each of the source files into the target, removing any comments
# and blank lines from the compiled executable
cat ${ZUNIT_BIN:h}/src/**/(^zunit).zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> "$ZUNIT_BIN"

# Print the main command last
cat ${ZUNIT_BIN:h}/src/zunit.zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> "$ZUNIT_BIN"

# Make sure the file is executable
chmod u+x "$ZUNIT_BIN"

# Let the user know we're finished
echo "\033[0;32m==>\033[0;m ZUnit built successfully at \033[0;32m${ZUNIT_BIN}\033[0;m"

0 comments on commit 1adae07

Please sign in to comment.