Class: Zold::Alias

Inherits:
Object
  • Object
show all
Includes:
ThreadBadge
Defined in:
lib/zold/commands/alias.rb

Overview

Command to set an alias for wallet ID

Instance Method Summary collapse

Constructor Details

#initialize(wallets:, log: Log::NULL) ⇒ Alias

Returns a new instance of Alias.



14
15
16
17
# File 'lib/zold/commands/alias.rb', line 14

def initialize(wallets:, log: Log::NULL)
  @wallets = wallets
  @log = log
end

Instance Method Details

#run(args = []) ⇒ Object

Raises:

  • (NotImplementedError)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/zold/commands/alias.rb', line 19

def run(args = [])
  opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
    o.banner = "Usage: zold alias [args]
#{Rainbow('alias set <wallet> <alias>').green}
  Make wallet known under an alias.
#{Rainbow('alias remove <alias>').green}
  Remove an alias.
#{Rainbow('alias show <alias>').green}
  Show where the alias is pointing to.
Available options:"
    o.bool '--help', 'Print instructions'
  end
  mine = Args.new(opts, @log).take || return
  command = mine[0]
  raise "A command is required, try 'zold alias --help'" unless command

  # @todo #279:30min Implement command handling. As in other commands,
  #  there should be case/when command/end loop and commands should be
  #  implemented as methods.
  raise NotImplementedError, 'This is not yet implemented'
end