diff options
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | ctct.in | 17 |
2 files changed, 10 insertions, 8 deletions
@@ -25,6 +25,7 @@ TODO file for ctct * [consider] Use regexes for --search-by-name. * [consider] For --search-by_data, use the '.' als alternative conjugation separator. +* Allow combination of --search-by-data and --search-by-name. [INTERNAL] * Be consistent in usage of [, test, [[. @@ -40,11 +40,11 @@ test -f "$user_config_file" \ && source "$user_config_file" ## CONSTANTS: -exec_name="${0##*/}" -RET_SUCCESS=@ret_success@ -RET_FAILURE=@ret_failure@ -RET_BADSYNTAX=@ret_badsyntax@ -RET_ERROR=@ret_error@ +typeset -r exec_name="${0##*/}" +typeset -r RET_SUCCESS=@ret_success@ +typeset -r RET_FAILURE=@ret_failure@ +typeset -r RET_BADSYNTAX=@ret_badsyntax@ +typeset -r RET_ERROR=@ret_error@ # Expand non matching globs to the empty string instead of themselves. @@ -180,8 +180,8 @@ function display_exact() "${visual_program[@]}" < "$file" || return $RET_ERROR else "${output_program[@]}" < "$file" | "${visual_program[@]}" - [[ ${PIPESTATUS[0]} -eq 0 || ${PIPESTATUS[1]} -eq 0 ]] \ - || return $RET_ERROR + [[ ${PIPESTATUS[0]} -ne 0 || ${PIPESTATUS[1]} -ne 0 ]] \ + && return $RET_ERROR fi return $RET_SUCCESS @@ -284,7 +284,8 @@ function list_all() [[ "$1" == 'full_path' ]] && fmt='%p\n' || fmt='%f\n' # Only list regular files with valid names. - find "$datadir" -maxdepth 1 -type f -regextype posix-extended -regex \ + find "$datadir" -mindepth 1 -maxdepth 1 -type f \ + -regextype posix-extended -regex \ '.*/[[:alpha:]]+([-_][[:alpha:]]+)*(\.[[:alpha:]]+([-_][[:alpha:]]+)*)?' \ -printf "$fmt" |