|
5 | 5 | ############################################################################### |
6 | 6 |
|
7 | 7 | __NAME__='annote' |
8 | | -__VERSION__='2.5.3' |
| 8 | +__VERSION__='2.5.4' |
9 | 9 |
|
10 | 10 | # variables |
11 | 11 | c_red="$(tput setaf 196)" |
@@ -69,6 +69,7 @@ flag_list_find="" # 'y' --> to show list of notes not |
69 | 69 | flag_show_archived="" # 'y' --> include archived notes into list/find, blank to exclude |
70 | 70 | flag_no_header="" # 'y' --> to remove header from output |
71 | 71 | flag_null_sep="" # 'y' --> to seperate records by null, empty to seperate by newline |
| 72 | +flag_tee="" # 'y' --> tee the captured stdin to the stdout |
72 | 73 | flag_debug_mutex_ops="$DBG_MUTEX_OPS" # 'y'|'yes' --> enable mutex multi opts execution, PS: supplying multi opts can creates confusion. |
73 | 74 |
|
74 | 75 | ERR_CONFIG=1 |
@@ -231,6 +232,8 @@ function help { |
231 | 232 | log_plain "${idnt_l1}$(as_bold "-z")|$(as_bold "-0")${fsep_4}Seperate record(s) by $(as_dim "NULL") character, instead of $(as_dim "NEWLINE")(default)." |
232 | 233 | log_plain "${idnt_l1}$(as_bold "--stdout")${fsep_3}Do not use pager, just put everything on $(as_bold "stdout")." |
233 | 234 | log_plain "${idnt_l1}$(as_bold "--inc-arch")${fsep_3}Include archived notes, default is to exclude. Effects $(as_bold "list") and $(as_bold "find") actions." |
| 235 | + log_plain "${idnt_l1}$(as_bold "--tee")${fsep_4}Redirect the captured $(as_bold 'stdin') to $(as_bold 'stdout'). Effects $(as_bold 'new'), and $(as_bold 'modify') actions, and only when" |
| 236 | + log_plain "${idnt_nl_prefx}recording note's content through $(as_bold 'stdin')." |
234 | 237 | log_plain "${idnt_l1}$(as_bold "--delim") [$(as_bold "$(as_light_green "delimiter")")]${fsep_2}Use $(as_bold "$(as_light_green "delimiter")") to delimit the list output fields." |
235 | 238 | log_plain "${idnt_l1}$(as_bold "--format") [$(as_bold "$(as_light_green "format")")]${fsep_2}Create custom $(as_underline "note listing") format with $(as_dim "$(as_underline "<SNO>")"),$(as_dim "$(as_underline "<NID>")"),$(as_dim "$(as_underline "<TITLE>")"),$(as_dim "$(as_underline "<TAGS>")"),$(as_dim "$(as_underline "<GROUP>")"),$(as_dim "$(as_underline "<DELIM>")")." |
236 | 239 | log_plain "${idnt_l1}$(as_bold "--sort-as") [$(as_bold "$(as_light_green "sf")")]${fsep_3}Use sort flag ($(as_bold "$(as_light_green "sf")")) to sort the notes listing. $(as_bold "$(as_light_green "sf")") can be: '$(as_dim 'L')|$(as_dim 'l')', '$(as_dim 'O')|$(as_dim 'o')', '$(as_dim 'F')|$(as_dim 'f')'," |
@@ -722,6 +725,7 @@ function add_note { |
722 | 725 | if [ "x$note" = "x-" ]; then |
723 | 726 | while IFS= read -r line; do |
724 | 727 | printf '%s\n' "$line" >> "$nf" |
| 728 | + [ "x$flag_tee" = "xy" ] && printf '%s\n' "$line" |
725 | 729 | done |
726 | 730 | else |
727 | 731 | if [ -n "$note" ] && [ -r "$note" ]; then |
@@ -1189,6 +1193,7 @@ function modify_note { |
1189 | 1193 | if [ "x$note" = "x-" ]; then |
1190 | 1194 | while IFS= read -r line; do |
1191 | 1195 | printf '%s\n' "$line" >> "$nf" |
| 1196 | + [ "x$flag_tee" = "xy" ] && printf '%s\n' "$line" |
1192 | 1197 | done |
1193 | 1198 | else |
1194 | 1199 | if [ -n "$note" ] && [ -r "$note" ]; then |
@@ -2374,6 +2379,9 @@ function parse_args { |
2374 | 2379 | "-z"|"-0") |
2375 | 2380 | flag_null_sep="y" |
2376 | 2381 | ;; |
| 2382 | + "--tee") |
| 2383 | + flag_tee="y" |
| 2384 | + ;; |
2377 | 2385 | "--delim") |
2378 | 2386 | store_kv_pair "list_delim=$1" |
2379 | 2387 | shift |
|
0 commit comments