Skip to content

Commit 31a8541

Browse files
kirtfitzpatrickKirt Fitzpatrick
andauthored
confirm_reset added, improved docs, bug fix on chap bpkg post (#54)
Co-authored-by: Kirt Fitzpatrick <[email protected]>
1 parent a7998a0 commit 31a8541

File tree

1 file changed

+44
-14
lines changed

1 file changed

+44
-14
lines changed

_posts/2021-05-06-chap.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ Options:
2828
-V|--version Print the current version and exit
2929

3030
Logging:
31-
info_msg MESSAGE
32-
nominal_msg MESSAGE
33-
attention_msg MESSAGE
34-
warning_msg MESSAGE
35-
modification_msg MESSAGE
31+
info_msg MESSAGE
32+
nominal_msg MESSAGE
33+
attention_msg MESSAGE
34+
warning_msg MESSAGE
35+
modification_msg MESSAGE
3636

3737
Evaluate command:
38-
info_cmd COMMAND [ MESSAGE ]
39-
nominal_cmd COMMAND [ MESSAGE ]
40-
attention_cmd COMMAND [ MESSAGE ]
41-
warning_cmd COMMAND [ MESSAGE ]
42-
modification_cmd COMMAND [ MESSAGE ]
43-
echo_cmd COMMAND
38+
info_cmd COMMAND [ MESSAGE ]
39+
nominal_cmd COMMAND [ MESSAGE ]
40+
attention_cmd COMMAND [ MESSAGE ]
41+
warning_cmd COMMAND [ MESSAGE ]
42+
modification_cmd COMMAND [ MESSAGE ]
43+
echo_cmd COMMAND
4444

4545
Internal:
4646
display_link FILE_LINK_OR_DIR_PATH
47-
brief_echo OUTPUT_STRING
47+
brief_echo OUTPUT_BUFFER
4848
brief_eval COMMAND
4949

5050
Iterate by line:
@@ -54,7 +54,8 @@ Iterate by line:
5454
Special purpose:
5555
print_header "$0 $*"
5656
verify_line_count LABEL COMPARISON_OP VALUE COMMAND
57-
confirm_cmd COMMAND [MESSAGE]
57+
confirm_cmd COMMAND [ MESSAGE ]
58+
confirm_reset # Reset auto-confirm
5859
{% endhighlight %}
5960

6061

@@ -69,6 +70,20 @@ chap info_msg "Let's verify line counts."
6970
chap verify_line_count \
7071
"files" "-ge" 4 \
7172
"find . -type f -or -type l"
73+
74+
echo ""
75+
chap info_msg "FYI."
76+
chap nominal_msg "As expected."
77+
chap attention_msg "Hey old chap, pay attention."
78+
chap warning_msg "Something's wrong."
79+
chap modification_msg "We're making a change."
80+
81+
echo ""
82+
chap info_cmd \
83+
"grep -A 4 'begin_line_looping {' deps/bin/chap" \
84+
"Implementation of begin_line_looping."
85+
86+
echo ""
7287
chap confirm_cmd "find . -name '*.sh'" \
7388
"Prompt to confirm or skip."
7489
{% endhighlight %}
@@ -86,6 +101,21 @@ chap confirm_cmd "find . -name '*.sh'" \
86101
./deps/bin/chap -> <span style="color:cyan">../chap/chap.sh</span><br />
87102
./deps/chap/chap.sh<br />
88103
./deps/chap/package.json<br />
104+
105+
<span style="color:cyan">Info:</span> FYI.<br />
106+
<span style="color:green">Nominal:</span> As expected.<br />
107+
<span style="color:yellow">Attention:</span> Hey old chap, pay attention.<br />
108+
<span style="color:red">Warning:</span> Something's wrong.<br />
109+
<span style="color:purple">Modification:</span> We're making a change.<br />
110+
111+
<span style="color:cyan">Info:</span> Implementation of begin_line_looping.<br />
112+
<span style="color:blue">grep -A 4 'begin_line_looping {' deps/bin/chap</span><br />
113+
function chap_begin_line_looping {<br />
114+
&nbsp; SAVEIFS=${IFS}<br />
115+
&nbsp; IFS=$(echo -en "\n\b")<br />
116+
&nbsp; echo "${SAVEIFS}"<br />
117+
}<br />
118+
89119
<span style="color:cyan">Info:</span> Prompt to confirm or skip.<br />
90120
<span style="color:blue">find . -name '*.sh'</span><br />
91121
<span style="color:purple">Execute (a=all, s=skip):</span> <br />
@@ -96,6 +126,6 @@ chap confirm_cmd "find . -name '*.sh'" \
96126

97127

98128
## Links
99-
* [Source Code (GitHub)][https://github.com/kirtfitzpatrick/chap]
129+
* [Source Code (GitHub)](https://github.com/kirtfitzpatrick/chap)
100130
* [Author: Kirt Fitzpatrick](https://twitter.com/KirtFitzpatrick)
101131
{% include JB/setup %}

0 commit comments

Comments
 (0)