lib/nin/command.rb in nin-1.2.0 vs lib/nin/command.rb in nin-1.3.0

- old
+ new

@@ -35,51 +35,57 @@ @todo.analyze when 'i', 'repl' run_interactive_mode when 'o', 'open' system("`echo $EDITOR` #{@todo.store.file}") + when 'v', 'version' + puts "nin #{Nin::VERSION}" else puts "NAME:\n\tnin - a simple, full-featured command line todo app" puts "\nUSAGE:\n\tnin COMMAND [arguments...]" puts "\nCOMMANDS:" puts "\tl | list [a|l] List all unarchived todos. Pass optional argument `a` to list all todos or `l` to list local todos only" puts "\ta | add desc Add a todo. Prepend due date by a @. Prepend each tag by a \\#" puts "\te | edit id desc Edit a todo. Prepend due date by a @. Prepend each tag by a \\#" puts "\tp | prioritize id step Prioritize a todo by either a positive or negative step within its date group" puts "\tc | complete id(s) Un/complete todo(s)" - puts "\tac | archive id(s) Un/archive todo(s)" + puts "\tac | archive id(s)|c Un/archive todo(s) or pass `c` to archive all completed items" puts "\td | delete id(s) Delete todo(s)" puts "\tgc | garbage Delete all archived todos. Resets item ids as a side effect" puts "\ts | analyze Analyze tasks and print statistics" puts "\ti | repl Open nin in REPL mode" puts "\to | open Open todo file in $EDITOR" + puts "\tv | version Print current version of nin" end end private def collect_config config = { store: YamlStore.new } - _client_name = @config.fetch(:integrated_client, nil) - _client_credentials = @config.fetch(:integrated_client_token, nil) + _client_name = @config.fetch(:integration_client, nil) + _client_credentials = @config.fetch(:integration_client_token, nil) + _timeout_interval = @config.fetch(:integration_timeout_interval, 60) if _client_name && _client_credentials _client_klass = Object.const_get("Nin::Integration::#{_client_name.capitalize}::Client") _synchronizer_klass = Object.const_get("Nin::Integration::Synchronizer::#{_client_name.capitalize}") - config[:integration_syncrhonizer] = _synchronizer_klass.new(_client_klass.new(_client_credentials)) + config[:integration_syncrhonizer] = _synchronizer_klass.new(_client_klass.new(_client_credentials), _timeout_interval) end config end def collect_options - options = { archived: false, local: false } + options = { archived: false, local: false, completed_only: false } if @command == 'l' && @args[0] == 'a' options[:archived] = true elsif @command == 'l' && @args[0] == 'l' options[:local] = true + elsif @command == 'ac' && @args[0] == 'c' + options[:completed_only] = true end options end