Add ? to kickstart.debugging

This commit is contained in:
Bruno Tavares 2014-03-20 13:47:29 -03:00
parent 9ee05e6933
commit fd524e0116
3 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@
* [kickstart.apt.ppa](kickstart/apt/ppa)
* [kickstart.command_exists](kickstart/command_exists)
* [kickstart.context](kickstart/context)
* [kickstart.debugging](kickstart/debugging)
* [kickstart.debugging?](kickstart/debugging?)
* [kickstart.download.file](kickstart/download/file)
* [kickstart.download.stream](kickstart/download/stream)
* [kickstart.file.contains](kickstart/file/contains)

View File

@ -1,15 +1,15 @@
# kickstart.debugging
# kickstart.debugging?
Returns 0 if you are debugging, and 1 if not
### Example
```bash
$ kickstart.debugging || echo nope
$ kickstart.debugging? || echo nope
nope
$ set -x; kickstart.debugging && echo yup; set +x;
+ kickstart.debugging
$ set -x; kickstart.debugging? && echo yup; set +x;
+ kickstart.debugging?
+ grep xtrace
+ kickstart.stream.contains on
+ grep -q on

View File

@ -8,13 +8,13 @@ kickstart.context() {
kickstart_context="$@"
}
kickstart.debugging() {
kickstart.debugging?() {
set -o | grep xtrace | kickstart.stream.contains on
}
kickstart.mute() {
kickstart.info "Running \"$@\""
if kickstart.debugging; then
if kickstart.debugging?; then
"$@"
else
`"$@" >/dev/null 2>&1`