From ef708570f1f42d9bb54ddc5b7b0432de4f761eb0 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 10 Mar 2024 20:25:06 -0400 Subject: [PATCH] minor improvements --- brc2 | 10 +++++++++- btrbk-run | 28 ++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/brc2 b/brc2 index e7d50e3..5c86f00 100644 --- a/brc2 +++ b/brc2 @@ -4055,7 +4055,7 @@ ref() { -o -name .hg -prune -o -name .editor-backups -prune \ -o -name .undo-tree-history -prune \) 2>/dev/null | grep -iP --color=auto -- "$*" ||: rgv -- "$*" $paths /a/work.org ||: - } +} # for use in /f/bind @@ -4349,6 +4349,14 @@ attach-txt() { done | ec } +ctof() { + units "tempC($1)" tempF +} + +ftoc() { + units "tempF($1)" tempC +} + export BASEFILE_DIR=/a/bin/fai-basefiles #export ANDROID_HOME=/a/opt/android-home diff --git a/btrbk-run b/btrbk-run index 34b23a8..1ca6f57 100644 --- a/btrbk-run +++ b/btrbk-run @@ -474,9 +474,31 @@ log_path=/var/log/btrbk/$(date +%F_%T%:::z).log echo copying output to $log_path exec &> >(pee cat 'ts "%F %T"|dd of='$log_path' status=none') - +# print some non-default opts if $verbose; then - printf " options: conf_only=%s\ndry_run=%s\nrate_limit=%s\nverbose=%s\ncmd_arg=%s\n" "$conf_only" "$dry_run" "$rate_limit" "$verbose" "$cmd_arg" + opts_show=() + if ! $conf_only; then + opts_show+=(conf_only=true) + fi + if ! $dry_run; then + opts_show+=(dry_run=true) + fi + if [[ $rate_limit != no ]]; then + opts_show+=("rate_limit=$rate_limit") + fi + if [[ $cmd_arg != run ]]; then + opts_show+=(cmd_arg=$cmd_arg) + fi + if (( $opts_show >= 1 )); then + first=true + for opt in ${opts_show[@]}; do + if $first; then + printf "%s" "$opt" + else + printf " %s" "$opt" + done + echo + fi fi if [[ -v targets ]]; then @@ -490,8 +512,6 @@ fi echo "mountpoints: ${mountpoints[*]}" - - # pull_reexec stops us from getting into an infinite loop if there is some # kind of weird problem pulla=false -- 2.30.2