forked from zunit-zsh/zunit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da6bdda
commit 042698e
Showing
1 changed file
with
17 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |