Unmute muted commands on debugging
This commit is contained in:
parent
cafc7b1d93
commit
44169e4f86
20
docs/kickstart/debugging.md
Normal file
20
docs/kickstart/debugging.md
Normal file
@ -0,0 +1,20 @@
|
||||
# kickstart.debugging
|
||||
|
||||
Returns 0 if you are debugging, and 1 if not
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
$ kickstart.debugging || echo nope
|
||||
nope
|
||||
|
||||
$ set -x; kickstart.debugging && echo yup; set +x;
|
||||
+ kickstart.debugging
|
||||
+ grep xtrace
|
||||
+ kickstart.stream.contains on
|
||||
+ grep -q on
|
||||
+ set -o
|
||||
+ echo yup
|
||||
yup
|
||||
+ set +x
|
||||
```
|
@ -8,9 +8,17 @@ kickstart.context() {
|
||||
kickstart_context="$@"
|
||||
}
|
||||
|
||||
kickstart.debugging() {
|
||||
set -o | grep xtrace | kickstart.stream.contains on
|
||||
}
|
||||
|
||||
kickstart.mute() {
|
||||
kickstart.info "Running \"$@\""
|
||||
`"$@" >/dev/null 2>&1`
|
||||
if kickstart.debugging; then
|
||||
"$@"
|
||||
else
|
||||
`"$@" >/dev/null 2>&1`
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user