mirror of
https://github.com/notwa/rc
synced 2024-11-05 00:19:02 -08:00
just conditionally source preload() instead of inlining it
also try out argc in stfu
This commit is contained in:
parent
d44da54b36
commit
addf7d1070
5 changed files with 6 additions and 13 deletions
2
sh/baks
2
sh/baks
|
@ -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 "$@"
|
||||
|
|
|
@ -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
2
sh/sc
|
@ -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 "$@"
|
||||
|
|
|
@ -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 "$@"
|
||||
|
|
6
sh/stfu
6
sh/stfu
|
@ -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 "$@"
|
||||
|
|
Loading…
Reference in a new issue