Class: Toolshed::Commands::GetDailyTimeUpdate
- Inherits:
-
Object
- Object
- Toolshed::Commands::GetDailyTimeUpdate
- Defined in:
- lib/toolshed/commands/get_daily_time_update.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cli_options ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/toolshed/commands/get_daily_time_update.rb', line 4 def self. { banner: 'Usage: get_daily_time_update [options]', options: { format: { short_on: '-f', }, use_defaults: { short_on: '-d' }, project_id: { short_on: '-p', } } } end |
Instance Method Details
#execute(args, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/toolshed/commands/get_daily_time_update.rb', line 21 def execute(args, = {}) begin time_tracking_class = Object.const_get("Toolshed::TimeTracking::#{Toolshed::Client.instance.time_tracking_tool.camel_case}") time_tracking_project_id = read_user_input_project_id("Project ID (Default: #{Toolshed::Client.instance.time_tracking_default_project_id}):", .merge!({ default: Toolshed::Client.instance.time_tracking_default_project_id })) .merge!({ project_id: time_tracking_project_id }) time_tracker = time_tracking_class.create_instance() puts "Getting time entries:" time_tracker.display rescue Exception => e puts "Time tracking tool is undefined implementation needed or an error occurred #{e.inspect}" return end end |
#read_user_input_project_id(message, options) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/toolshed/commands/get_daily_time_update.rb', line 37 def read_user_input_project_id(, ) return [:project_id] if (.has_key?(:project_id)) return [:default] if (Toolshed::Client.instance.use_defaults) puts value = $stdin.gets.chomp if (value.empty?) value = [:default] end value end |