1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-06 17:33:06 -07:00

just conditionally source preload() instead of inlining it

also try out argc in stfu
This commit is contained in:
Connor Olding 2021-08-02 14:08:00 -07:00
parent d44da54b36
commit addf7d1070
5 changed files with 6 additions and 13 deletions

View File

@ -32,6 +32,6 @@ baks() { ### @-
return $ret
}
preload() { local preload='set -- $@'; while [ $# -gt 0 ]; do . ~/sh/$1 || exit 2; shift; done; }
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} note
[ -n "${preload+-}" ] || baks "$@"

View File

@ -1,11 +1,4 @@
#!/usr/bin/env false
# NO_ZSH
# NO_BASH
# NO_DASH
# NO_ASH
# NOTE: this is actually compatible with all of the above shells;
# i just really don't want it being sourced by accident.
# this file really only exists for documentation purposes.
preload() { ### @- handle dependencies within the [`~/sh/`](/sh) directory.
### this function contains more comments than code, so you should read it.

2
sh/sc
View File

@ -62,6 +62,6 @@ sc() { ### @-
return 0
}
preload() { local preload='set -- $@'; while [ $# -gt 0 ]; do . ~/sh/$1 || exit 2; shift; done; }
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} ea
[ -n "${preload+-}" ] || sc "$@"

View File

@ -14,6 +14,6 @@ scropt() { ### @-
[ $? -eq 0 ] && echo "$fn" || return $?
}
preload() { local preload='set -- $@'; while [ $# -gt 0 ]; do . ~/sh/$1 || exit 2; shift; done; }
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} now
[ -n "${preload+-}" ] || scropt "$@"

View File

@ -41,7 +41,7 @@ stfu() { ### @-
### WARNING: The system cannot find the file specified.
### asses
### ```
[ $# -gt 0 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
argc -ge 1 "$0" "$@" || return
local dirty=0 temp="$STFU_DIR"
if [ -z "$temp" ]; then
@ -99,6 +99,6 @@ stfu() { ### @-
return $ret
}
preload() { local preload='set -- $@'; while [ $# -gt 0 ]; do . ~/sh/$1 || exit 2; shift; done; }
eval ${preload:-preload} echo2 note
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} argc echo2 note
[ -n "${preload+-}" ] || stfu "$@"