class Hbtrack::RemoveCommand

Public Class Methods

new(store_path, options) click to toggle source
Calls superclass method Hbtrack::Command::new
# File lib/hbtrack/command/remove_command.rb, line 8
def initialize(store_path, options)
  super(store_path, options)
end

Public Instance Methods

create_option_parser() click to toggle source
# File lib/hbtrack/command/remove_command.rb, line 17
def create_option_parser
  OptionParser.new do |opts|
    opts.banner = 'Usage: hbtrack remove [<habit_name>]'
  end
end
execute() click to toggle source
Calls superclass method Hbtrack::Command#execute
# File lib/hbtrack/command/remove_command.rb, line 12
def execute
  return remove_from_db(@names, local_store)
  super
end
feedback(names) click to toggle source
# File lib/hbtrack/command/remove_command.rb, line 23
def feedback(names)
  Hbtrack::Util.blue("Remove #{names.join(',')}!")
end
remove_from_db(names, store) click to toggle source
# File lib/hbtrack/command/remove_command.rb, line 27
def remove_from_db(names, store)
  status = store.delete_habit(names)
  return ErrorHandler.raise_if_habit_error(names) if status == 0

  feedback(names)
end