class R2do::Commands::NowCommand
Public Class Methods
new(state)
click to toggle source
Calls superclass method
R2do::Command::new
# File lib/r2do/commands/now_command.rb, line 21 def initialize(state) super('n', 'now', 'Displays the information for the current category.') @state = state end
Public Instance Methods
display_current_category(args)
click to toggle source
Shows the detailed information for the current category, including the tasks contained
@param [Array] args the arguments passed to the app by the user @return [void]
# File lib/r2do/commands/now_command.rb, line 41 def display_current_category(args) #TODO: need to refatctor the code to remove the duplication if not @state.current_category UI.status("No category is currently selected.") else UI.status(@state.current_category.to_s) UI.new_line() end end
execute(args)
click to toggle source
Creates a new category or makes a category current in the state if a category with the same name already exists
@param [Array] args the arguments passed to the app by the user @raise [ArgumentError] if the command does not contain a name for the category @return [void]
# File lib/r2do/commands/now_command.rb, line 33 def execute(args) display_current_category(args) end
help()
click to toggle source
# File lib/r2do/commands/now_command.rb, line 51 def help() help = <<-EOF NAME r2do #{@extended} SYNOPSIS 'r2do #{@extended}' or 'r2do #{@short}' are equivalent DESCRIPTION The #{@extended} lets view the current category and its tasks usage: r2do #{@extended} EOF end