about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-07-22 15:18:43 -0500
committerCase Duckworth2022-07-22 15:18:43 -0500
commit250844dc34206490fc418f19ce33f2471f9520a0 (patch)
tree5998cd2f8e3e63a6a56096d05dd83347f33a19a8
parentAdd README (diff)
downloadradish-250844dc34206490fc418f19ce33f2471f9520a0.tar.gz
radish-250844dc34206490fc418f19ce33f2471f9520a0.zip
Break _radish_not_running into its own function
-rwxr-xr-xradish18
1 files changed, 12 insertions, 6 deletions
diff --git a/radish b/radish index d8c55b1..0883946 100755 --- a/radish +++ b/radish
@@ -118,16 +118,22 @@ _radish_tags() {
118 cut -f3 "${1:--}" 2>/dev/null 118 cut -f3 "${1:--}" 2>/dev/null
119} 119}
120 120
121_radish_not_running() {
122 echo >&2 "Running radish not found."
123 exit 2
124}
125
121echo() { printf '%s\n' "$*"; } 126echo() { printf '%s\n' "$*"; }
122 127
123### Main functionality 128### Main functionality
124 129
125radish_kill() { 130radish_kill() {
126 printf >&2 '%s' "Killing radish..." 131 if [ -f "$RADISH_PID_FILE" ]; then
127 _radish_kill_impl || { 132 printf >&2 '%s' "Killing radish..."
128 echo >&2 "I don't think radish is running." 133 _radish_kill_impl
129 exit 2 134 else
130 } 135 _radish_not_running
136 fi
131 cleanup 137 cleanup
132 exit 138 exit
133} 139}
@@ -139,7 +145,7 @@ radish_status() {
139 else 145 else
140 follow= 146 follow=
141 fi 147 fi
142 tail $follow "$RADISH_STATUS_FILE" 148 tail $follow "$RADISH_STATUS_FILE" 2>/dev/null || _radish_not_running
143 echo 149 echo
144 exit 150 exit
145} 151}