Class: Rly::Commands::Remove

Inherits:
Rly::Command show all
Defined in:
lib/rly/commands/remove.rb

Instance Method Summary collapse

Methods inherited from Rly::Command

#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which

Constructor Details

#initialize(name, options) ⇒ Remove

Returns a new instance of Remove.



9
10
11
12
# File 'lib/rly/commands/remove.rb', line 9

def initialize(name, options)
  @name = name
  @options = options
end

Instance Method Details

#execute(input: $stdin, output: $stdout) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/rly/commands/remove.rb', line 14

def execute(input: $stdin, output: $stdout)
  shortcuts = Rly::Shortcuts.new
  if shortcuts.exist?(@name)
    shortcuts.destroy(@name)
    output.puts "removed #{@name} for this directory"
  else
    output.puts "can't find shortcut with name #{@name}"
  end
end