From 72cd558d5d6c4965bb35ed1f9175a4528421ad7a Mon Sep 17 00:00:00 2001 From: Einhard Leichtfuß Date: Tue, 25 Dec 2018 17:21:08 +0100 Subject: Fix --search-by-data and rename its bash function --- TODO | 6 ++++++ ctct.in | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index ca9ada7..3867057 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,7 @@ TODO file for ctct * Use git tags for future versions. * [consider] Remove character restriction except '.', '/'. * [consider] Require at least one argument for --search-by-*. +* [consider] Treat everything case insensitive. [CONFIGURE SCRIPT] @@ -22,6 +23,11 @@ TODO file for ctct `- nano, easily understandable. `- ed, the editor. * [consider] Use regexes for --search-by-name. +* [consider] For --search-by_data, use the '.' als alternative conjugation + separator. + +[INTERNAL] +* [consider] Initial cd to $datadir. [MANUAL] * Add an EXAMPLE section to ctct(1). diff --git a/ctct.in b/ctct.in index 44c271a..e1cad6b 100644 --- a/ctct.in +++ b/ctct.in @@ -99,7 +99,7 @@ function main() elif [ "$1" = "-S" ] || \ ( [[ "--search-by-data" =~ ^"$1" ]] && [ ${#1} -ge 13 ] ) then - shift; search_by_content "Found:" "$@"; return $? + shift; search_by_data "Found:" "$@"; return $? elif [ "$1" = "-e" ] || ( [[ "--edit" =~ ^"$1" ]] && [ ${#1} -ge 3 ] ) then test $# -lt 2 && print_error "$exec_name: no entry specified." \ @@ -222,7 +222,7 @@ function search_by_name() # $1: initial success message # ${@:2}: regular expressions -function search_by_content() +function search_by_data() { local msg files regexp ret @@ -233,7 +233,6 @@ function search_by_content() # equally. cd "$datadir" files=( $(list_all || return $RET_ERROR) ) - cd - for regexp in "${@,,}" do -- cgit v1.2.3