Class: Rubyists::Opr::Commands::Get
- Inherits:
-
Rubyists::Opr::Command
- Object
- Rubyists::Opr::Command
- Rubyists::Opr::Commands::Get
- Defined in:
- lib/rubyists::opr/commands/get.rb
Overview
‘get’ 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) ⇒ Get
constructor
A new instance of Get.
Methods inherited from Rubyists::Opr::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(item, options) ⇒ Get
Returns a new instance of Get.
10 11 12 13 |
# File 'lib/rubyists::opr/commands/get.rb', line 10 def initialize(item, ) @item = item @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rubyists::opr/commands/get.rb', line 15 def execute(input: $stdin, output: $stdout) # rubocop:disable Lint/UnusedMethodArgument if [:vault] vault = [:vault] else split = @item.split('/', 2) vault, @item = split if split.size == 2 end if vault.nil? warn 'No vault specified, using "Private"' vault = 'Private' end Opr.with_login { output.puts Item.find(@item, vault: vault).password } end |