diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-23 18:00:06 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-23 18:00:06 -0800 |
commit | d6e3c023da778305efe8180835c6debba78e5138 (patch) | |
tree | 0c74bbc7f94b91d39007aa05a9e600ca1a449497 /ag | |
parent | Expose delete index. (diff) | |
download | backend-d6e3c023da778305efe8180835c6debba78e5138.tar.gz backend-d6e3c023da778305efe8180835c6debba78e5138.tar.bz2 backend-d6e3c023da778305efe8180835c6debba78e5138.zip |
Ability to turn off the progress bar.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'ag')
-rwxr-xr-x | ag | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -25,6 +25,7 @@ $options.no_threading = false $options.debug = false $options.readonly = false $options.jobs = false +$options.progress = true op = OptionParser.new do |opts| opts.banner = "Usage: ag <<--index-full|--index-new|--delete-msg|--delete-index|--reindex|--info> <--list listname>> <[--file|--msgid|--hash] <maildir/file/hash/messageid>> [options]" @@ -104,6 +105,13 @@ op = OptionParser.new do |opts| opts.on('--jobs JOBS', 'Number of parallel jobs to run (defaults to 75% of core count)') do |jobs| $options.jobs = jobs.to_i end + + opts.on('--progress', 'Display the progress bar') do + $options.progress = true + end + opts.on('--no-progress', 'Do not display the progress bar') do + $options.progress = false + end end op.parse! @@ -130,7 +138,11 @@ def do_full messages = $maildir.list(:cur) - Parallel.each(messages, in_processes: Ag::Utils.proc_count, progress: "Importing #{$options.name}") do |maildir_message| + opts = { + :in_processes: Ag::Utils.proc_count, + } + opts[:progress] = "Importing #{$options.name}" if $options.progress + Parallel.each(messages, opts) do |maildir_message| mail = maildir_message.data begin @@ -147,7 +159,11 @@ end def do_incremental messages = $maildir.list(:cur) - Parallel.each(messages, in_processes: Ag::Utils.proc_count, progress: "Importing #{$options.name}") do |maildir_message| + opts = { + :in_processes: Ag::Utils.proc_count, + } + opts[:progress] = "Importing #{$options.name}" if $options.progress + Parallel.each(messages, opts) do |maildir_message| mail = maildir_message.data begin |