commit 159fe820d4a0cb420fe89c2d133f0ceb1cdef1a3
parent 2520aebac6ee7c126786e9dbb1d086575fb54878
Author: William Casarin <jb55@jb55.com>
Date: Sat, 10 Apr 2021 10:00:00 -0700
Revert "Add fuzzy-patch-thread-selecting"
This reverts commit e5661eb80b5cff0dc2ec29fc199557339289aa72.
This was breaking notmuch-am:
$ notmuch am <thread-id>
Fails saying there are no arguments given
Diffstat:
1 file changed, 3 insertions(+), 25 deletions(-)
diff --git a/notmuch-am b/notmuch-am
@@ -30,7 +30,6 @@ _positionals=()
_arg_am="off"
_arg_3="off"
_arg_amsignoff="off"
-_arg_fuzzy="off"
print_help()
@@ -41,7 +40,6 @@ print_help()
printf '\t%s\n' "--am, --no-am: Call git-am instead of generating a mbox file (off by default)"
printf '\t%s\n' "-3: Call git-am with -3 (off by default, only effective with --am)"
printf '\t%s\n' "-s, --signoff: Call git-am with --signoff (off by default, only effective with --am)"
- printf '\t%s\n' "--fuzzy: Use fzf to interactively select the thread for the patchset to apply"
printf '\t%s\n' "-h, --help: Prints help"
printf %s "\
@@ -84,9 +82,6 @@ parse_commandline()
-l|--add-link)
_arg_b4addlink="on"
;;
- --fuzzy)
- _arg_fuzzy="on"
- ;;
*)
_last_positional="$1"
_positionals+=("$_last_positional")
@@ -101,12 +96,8 @@ parse_commandline()
handle_passed_args_count()
{
local _required_args_string="'thread-id'"
- if [[ "${_positionals_count}" -ge 1 ]] && [[ "$_arg_fuzzy" == "off" ]]; then
- _PRINT_HELP=yes die "FATAL ERROR: Not enough positional arguments - we require exactly 1 (namely: $_required_args_string), but got only ${_positionals_count}." 1
- fi
- if [[ "${_positionals_count}" -le 1 ]] && [[ "$_arg_fuzzy" == "off" ]]; then
- _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect exactly 1 (namely: $_required_args_string), but got ${_positionals_count} (the last one was: '${_last_positional}')." 1
- fi
+ test "${_positionals_count}" -ge 1 || _PRINT_HELP=yes die "FATAL ERROR: Not enough positional arguments - we require exactly 1 (namely: $_required_args_string), but got only ${_positionals_count}." 1
+ test "${_positionals_count}" -le 1 || _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect exactly 1 (namely: $_required_args_string), but got ${_positionals_count} (the last one was: '${_last_positional}')." 1
}
@@ -164,18 +155,5 @@ main () {
rm -f "$mbox"
}
-thread_id="$_arg_thread_id"
-
-if [[ "$_arg_fuzzy" == "on" ]]; then
- preview_script='echo {} | sed "s,\t.*,,; s,^,thread:," | xargs notmuch search --output=files --format=text | xargs grep -ihE "^Subject" | sort'
-
- user_email="$(git config user.email)"
-
- thread_id=$(notmuch search --output=summary --format=json "to:$user_email" and subject:PATCH | \
- jq -rcC '.[] | [.thread,.date_relative,.subject,.authors] | @tsv' | \
- fzf -m --preview "$preview_script" | \
- sed 's,\t.*,,; s,^,thread:,')
-fi
-
-[ -n "$1" ] || usage && main "$thread_id"
+[ -n "$1" ] || usage && main "$_arg_thread_id"