diff --git a/container/src/finance/lib/internal/lib_edit.bash b/container/src/finance/lib/internal/lib_edit.bash index 5078cda..4e45bd6 100644 --- a/container/src/finance/lib/internal/lib_edit.bash +++ b/container/src/finance/lib/internal/lib_edit.bash @@ -59,7 +59,7 @@ function lib_edit::__parse_args() Configuration type: - type${global_arg_delim_2} + type${global_arg_delim_2} Account: @@ -246,11 +246,13 @@ function lib_edit::__edit() _path+="/post-import.journal" [ ! -f "$_path" ] && touch "$_path" - # TODO: upstream request to provide comment(N) entries - [[ "$_type" == "iadd" ]] && /usr/bin/hledger-iadd -f "$_path" + if [[ "$_type" == "iadd" ]]; then + hledger-iadd -f "$_path" || lib_utils::die_fatal + fi - # TODO: option for editor type - [[ "$_type" == "manual" ]] && $EDITOR "$_path" + if [[ "$_type" == "manual" ]]; then + $EDITOR "$_path" || lib_utils::die_fatal + fi ;; meta) [ -z "$global_conf_meta" ] && lib_utils::die_fatal @@ -271,11 +273,12 @@ function lib_edit::__edit() # - If saved to original, opening with `--skip` will clobber the # original file's comments. local -r _skip="$(grep -E "^//!" $_path | wc -l)" - visidata --quitguard --motd-url file:///dev/null --filetype csv --skip "$_skip" "$_path" + local -r _args=("--quitguard" "--motd-url" "file:///dev/null" "--filetype" "csv" "--skip" "$_skip" "$_path") + visidata "${_args[@]}" || lib_utils::die_fatal # TODO: HACK: visidata saves w/ DOS-style carriage... # ...but there seems to be no option out of this. - sed -i 's:\r::g' "$_path" + sed -i 's:\r::g' "$_path" || lib_utils::die_fatal ;; preprocess | rules) # Run all paths through one editor instance