Allow negating flag options

This commit is contained in:
Raman Gupta 2023-04-20 13:24:29 -04:00
parent d117d6e3fa
commit 1d39bc2a84
2 changed files with 28 additions and 2 deletions

View File

@ -125,7 +125,7 @@ to see the exact location) for configuration.
For example, if one wishes to scan receipts always with crop, deskew, unpaper
post-processing, and making them searchable via OCR, a `receipt` option group
can be created by writing the following to a file named `recept` in the
can be created by writing the following to a file named `receipt` in the
config directory:
```
@ -136,7 +136,13 @@ SEARCHABLE=1
```
Command-line arguments will overwride settings in the default and named
configurations.
configurations. All command line flags support prefixing with `no-` in order to
override configuration settings. For example, to scan receipts using the option
group above, but without making it searchable, you would do:
```
--option-group receipt --no-searchable
```
### Tips

20
scan
View File

@ -83,16 +83,24 @@ while [[ $# > 0 ]]; do
-v|--verbose) VERBOSE=1 ;;
--no-verbose) VERBOSE=0 ;;
-d|--duplex) DUPLEX=1 ;;
-d|--no-duplex) DUPLEX=0 ;;
-m|--mode) shift; MODE=$1; MODE_CHANGED=1 ;;
--mode-hw-default) MODE_HW_DEFAULT=1 ;;
--no-mode-hw-default) MODE_HW_DEFAULT=0 ;;
-r|--resolution) shift; RESOLUTION=$1 ;;
-a|--append) APPEND=1 ;;
--no-append) APPEND=0 ;;
-e|--max) shift; MAXPAGE=$1 ;;
-t|--truncate) shift; TRUNCPAGE=$1 ;;
@ -110,16 +118,26 @@ while [[ $# > 0 ]]; do
--crop) CROP=1 ;;
--no-crop) CROP=0 ;;
--deskew) DESKEW=1 ;;
--no-deskew) DESKEW=0 ;;
--unpaper) UNPAPER=1 ;;
--no-unpaper) UNPAPER=0 ;;
--searchable|--ocr) SEARCHABLE=1 ;;
--no-searchable|--no-ocr) SEARCHABLE=0 ;;
--language) shift; LANGUAGE=$1 ;;
--skip-empty-pages) SKIP_EMPTY_PAGES=1 ;;
--no-skip-empty-pages) SKIP_EMPTY_PAGES=0 ;;
--white-threshold) shift; WHITE_THRESHOLD=$1 ;;
-o|--output) shift; USEOUTPUT=1; OUTPUT="$1" ;;
@ -134,6 +152,8 @@ while [[ $# > 0 ]]; do
--open) OPENSCAN=1 ;;
--no-open) OPENSCAN=0 ;;
# ignore, already handled
-og|--option-group) shift ;;