From 4dab299619fd627e9bbc9ab9907d18581e4c2d69 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 2 Jul 2019 13:27:07 -0700 Subject: [PATCH] Fix parameterization of --verbose --- misc/completion/ocrmypdf.bash | 2 +- misc/completion/ocrmypdf.fish | 8 +++++++- src/ocrmypdf/cli.py | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/misc/completion/ocrmypdf.bash b/misc/completion/ocrmypdf.bash index 010fcf7f..d3bc6b80 100644 --- a/misc/completion/ocrmypdf.bash +++ b/misc/completion/ocrmypdf.bash @@ -49,7 +49,7 @@ _ocrmypdf() return ;; -v|--verbose) - COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) ) # max level ? + COMPREPLY=( $( compgen -W '{0..2}' -- "$cur" ) ) # max level ? return ;; --tesseract-pagesegmode) diff --git a/misc/completion/ocrmypdf.fish b/misc/completion/ocrmypdf.fish index 6517a87a..24883be1 100644 --- a/misc/completion/ocrmypdf.fish +++ b/misc/completion/ocrmypdf.fish @@ -46,8 +46,14 @@ function __fish_ocrmypdf_optimize end complete -c ocrmypdf -x -s O -l optimize -a '(__fish_ocrmypdf_optimize)' -d "select optimization level" +function __fish_ocrmypdf_verbose + echo -e "0\t"(_ "standard output messages") + echo -e "1\t"(_ "troubleshooting output messages") + echo -e "2\t"(_ "debugging output messages") +end +complete -c ocrmypdf -x -s v -l verbose -a '(__fish_ocrmypdf_verbose)' -d "set verbosity level" + complete -c ocrmypdf -x -s j -l jobs -d "how many worker processes to use" -complete -c ocrmypdf -x -s v -a '(seq 1 9)' complete -c ocrmypdf -x -l title -d "set metadata" complete -c ocrmypdf -x -l author -d "set metadata" complete -c ocrmypdf -x -l subject -d "set metadata" diff --git a/src/ocrmypdf/cli.py b/src/ocrmypdf/cli.py index d3011995..5e639155 100644 --- a/src/ocrmypdf/cli.py +++ b/src/ocrmypdf/cli.py @@ -186,8 +186,9 @@ jobcontrol.add_argument( jobcontrol.add_argument( '-v', '--verbose', - type=int, + type=numeric(int, 0, 2), default=0, + const=1, nargs='?', help="Print more verbose messages for each additional verbose level. Use " "`-v 1` typically for much more detailed logging. Higher numbers "