Class: SidekiqUniqueJobs::Cli
- Inherits:
-
Thor
- Object
- Thor
- SidekiqUniqueJobs::Cli
- Defined in:
- lib/sidekiq_unique_jobs/cli.rb
Overview
Command line interface for unique jobs
Class Method Summary collapse
-
.banner(command, _namespace = nil, _subcommand = false) ⇒ Object
:nodoc: rubocop:disable Style/OptionalBooleanParameter.
Instance Method Summary collapse
-
#console ⇒ Object
:nodoc:.
-
#del(pattern) ⇒ Object
:nodoc:.
-
#list(pattern = "*") ⇒ Object
:nodoc:.
Class Method Details
.banner(command, _namespace = nil, _subcommand = false) ⇒ Object
:nodoc: rubocop:disable Style/OptionalBooleanParameter
14 15 16 |
# File 'lib/sidekiq_unique_jobs/cli.rb', line 14 def self.(command, _namespace = nil, _subcommand = false) # rubocop:disable Style/OptionalBooleanParameter "jobs #{@package_name} #{command.usage}" # rubocop:disable ThreadSafety/InstanceVariableInClassMethod end |
Instance Method Details
#console ⇒ Object
:nodoc:
45 46 47 48 49 50 51 52 |
# File 'lib/sidekiq_unique_jobs/cli.rb', line 45 def console say "Use `list '*', 1000 to display the first 1000 unique digests matching '*'" say "Use `del '*', 1000, true (default) to see how many digests would be deleted for the pattern '*'" say "Use `del '*', 1000, false to delete the first 1000 digests matching '*'" # Object.include SidekiqUniqueJobs::Api console_class.start end |
#del(pattern) ⇒ Object
:nodoc:
34 35 36 37 38 39 40 41 |
# File 'lib/sidekiq_unique_jobs/cli.rb', line 34 def del(pattern) max_count = [:count] if [:dry_run] count_entries_for_del(max_count, pattern) else del_entries(max_count, pattern) end end |
#list(pattern = "*") ⇒ Object
:nodoc:
22 23 24 25 26 27 28 |
# File 'lib/sidekiq_unique_jobs/cli.rb', line 22 def list(pattern = "*") max_count = [:count] say "Searching for regular digests" list_entries(digests.entries(pattern: pattern, count: max_count), pattern) say "Searching for expiring digests" list_entries(expiring_digests.entries(pattern: pattern, count: max_count), pattern) end |