class R2do::Commands::InitCommand
Constants
- YES
Public Class Methods
new(state)
click to toggle source
Calls superclass method
R2do::Command::new
# File lib/r2do/commands/init_command.rb, line 23 def initialize(state) super('i', 'init', 'Initializes a new clean session.') @state = state end
Public Instance Methods
execute(args)
click to toggle source
Initializes the applications and resets the datafile
@param [Array] args the arguments passed to the app by the user @return [void]
# File lib/r2do/commands/init_command.rb, line 33 def execute(args) UI.status("Initialize new session?") UI.new_line() value = UI.input("Any previous session will be lost. Continue? [Yn]") if value == YES @state.reset() @state.modified = true UI.status("Initialized a new session of r2do.") else UI.status("Continuing with current session.") end end
help()
click to toggle source
# File lib/r2do/commands/init_command.rb, line 46 def help() help = <<-EOF NAME r2do #{@extended} SYNOPSIS 'r2do #{@extended}' or 'r2do #{@short}' are equivalent DESCRIPTION The #{@extended} command initializes a new session of the application. Any previously saved data is permanently lost. usage: r2do #{@extended} EOF end