Class: Rubyists::Opr::Commands::Rm
- Inherits:
-
Rubyists::Opr::Command
- Object
- Rubyists::Opr::Command
- Rubyists::Opr::Commands::Rm
- Defined in:
- lib/rubyists::opr/commands/rm.rb
Overview
the rm command
Instance Attribute Summary
Attributes inherited from Rubyists::Opr::Command
Instance Method Summary collapse
-
#execute(input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
-
#initialize(item, options) ⇒ Rm
constructor
A new instance of Rm.
Methods inherited from Rubyists::Opr::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(item, options) ⇒ Rm
Returns a new instance of Rm.
11 12 13 14 |
# File 'lib/rubyists::opr/commands/rm.rb', line 11 def initialize(item, ) @item = item @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubyists::opr/commands/rm.rb', line 16 def execute(input: $stdin, output: $stdout) # rubocop:disable Lint/UnusedMethodArgument vault_name = if [:vault] [:vault] else warn 'No vault given, using "Private"' 'Private' end Opr.with_login do found = Item.find(@item, vault: vault_name) return(output.puts("No item '#{@item}' found in vault '#{vault_name}'")) if found.nil? found.delete! output.puts "Removed '#{@item}' from '#{vault_name}'" end end |