From 5edebea0a738117dde41077cd23756e79f4417e7 Mon Sep 17 00:00:00 2001 From: maxice8 Date: Mon, 19 Nov 2018 00:31:32 -0200 Subject: xlocate: don't mark anything starting with a hyphen as an invalid option Unbreaks usecases where you want to start searching all files that end with - like -config or -x11 Closes: #105 [via git-merge-pr] --- xlocate | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'xlocate') diff --git a/xlocate b/xlocate index 1d2d41b..a4f013f 100755 --- a/xlocate +++ b/xlocate @@ -52,9 +52,6 @@ case "$1" in -S) xsyncgit exit $?;; --*) - echo "xlocate: invalid option '$1'" 1>&2 - exit 1;; '') echo "Usage: xlocate [-g | -S | PATTERN]" 1>&2 exit 1;; @@ -73,9 +70,9 @@ if [ -d "$XLOCATE_GIT" ]; then echo "xlocate: database outdated, please run xlocate -g." 1>&2 fi fi - git -c grep.lineNumber=false --git-dir="$XLOCATE_GIT" grep "$@" @ | + git -c grep.lineNumber=false --git-dir="$XLOCATE_GIT" grep -- "$@" @ | sed 's/^@://; s/:/\t/' | grep . else - xbps-query --regex -Ro "$@" | + xbps-query --regex -Ro -- "$@" | sed 's/ *([^)]*)$//; s/^\([^ ]*\)-[^-]*: /\1\t/' fi -- cgit 1.4.1