Skip to content

Commit

Permalink
fix: zunit build path
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdoster authored Sep 13, 2023
1 parent da6bdda commit 042698e
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions build.zsh
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
#!/usr/bin/env zsh

emulate -L zsh
setopt extended_glob

# According to the Zsh Plugin Standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"

(){
emulate -L zsh
setopt extended_glob

local ZUNIT_DIR="${${0:h}:A}"
local ZUNIT_BIN="$ZUNIT_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_DIR}/src/**/(^zunit).zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> "$ZUNIT_BIN"
# Print the main command last
cat ${ZUNIT_DIR}/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"
}
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"

0 comments on commit 042698e

Please sign in to comment.