diff --git a/README.md b/README.md index 3faa682..0e6595f 100644 --- a/README.md +++ b/README.md @@ -16,21 +16,24 @@ for removal. Non-text files are ignored at the moment and can be removed one by one if desired. - syncthing-resolve-conflicts v1.0.0 - - Inspired by 'pacdiff'. - A simple program to merge or remove sync conflicts. - Locate is used to find conflicts. - In case the database is not recent, run 'updatedb'. - + syncthing-resolve-conflicts v1.0.2 + + Inspired by 'pacdiff'. A simple program to merge or remove sync conflicts. + Locate is used to find conflicts. In case the database is not recent, run + 'updatedb'. + Usage: syncthing-resolve-conflicts [-o] [--nocolor] - + General Options: -o/--output print files instead of merging them + -f/--find use find instead of locate (scans only home directory) --nocolor remove colors from output - + -v/--version print version and exit + -h/--help print usage and exit + Environment Variables: DIFFPROG override the merge program: (default: 'vim -d') - + Example: DIFFPROG=meld syncthing-resolve-conflicts Example: syncthing-resolve-conflicts --output + diff --git a/syncthing-resolve-conflicts b/syncthing-resolve-conflicts index 38f910c..92c5079 100755 --- a/syncthing-resolve-conflicts +++ b/syncthing-resolve-conflicts @@ -4,10 +4,11 @@ # 'pacdiff'. declare -r myname='syncthing-resolve-conflicts' -declare -r myver='1.0.1' +declare -r myver='1.0.2' diffprog=${DIFFPROG:-'vim -d'} USE_COLOR='y' +declare -i USE_FIND=0 declare -a ignored declare -a nontext @@ -77,6 +78,7 @@ Usage: $myname [-o] [--nocolor] General Options: -o/--output print files instead of merging them + -f/--find use find instead of locate (scans only home directory) --nocolor remove colors from output -v/--version print version and exit -h/--help print usage and exit @@ -97,18 +99,24 @@ version() { } cmd() { - case "$(uname -s)" in - Darwin) - locate -0 sync-conflict;; - *) - locate -0 -e -b sync-conflict;; - esac + if (( USE_FIND )); then + find ~/ -name '*sync-conflict*' -print0 + else + case "$(uname -s)" in + Darwin) + locate -0 sync-conflict;; + *) + locate -0 -e -b sync-conflict;; + esac + fi } while [[ -n "$1" ]]; do case "$1" in -o|--output) OUTPUTONLY=1;; + -f|--find) + USE_FIND=1;; --nocolor) USE_COLOR='n';; -v|-V|--version)