Class: Kuzya::Commands::Add

Inherits:
Base
  • Object
show all
Defined in:
lib/kuzya/commands/add.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

args_without_command, call

Constructor Details

#initialize(args, config) ⇒ Add

Returns a new instance of Add.



22
23
24
25
# File 'lib/kuzya/commands/add.rb', line 22

def initialize(args, config)
  @args = args
  @config = config
end

Class Method Details

.infoObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/kuzya/commands/add.rb', line 5

def info
<<-INFO
#{'add'.bold} - to add new shortcut use #{'kuzya add short www.example.com'.italic}.
You can adds shortcuts inside other shurtcuts, e.g.
  #{'kuzya add stack https://stackoverflow.com'.italic}
  #{'kuzya add stack q questions'.italic}
  #{'kuzya add stack q active ?tab=Active'.italic}
And now if run '#{'kuzya stack q active'.italic}' you will see all active questions
Note: You can't add first-level shortcuts named as [add, remove, rm, list, help, version, -v, --version]
INFO
end

.prepare(args, config) ⇒ Object



17
18
19
# File 'lib/kuzya/commands/add.rb', line 17

def prepare(args, config)
  [args_without_command(args), config]
end

Instance Method Details

#callObject



27
28
29
30
31
# File 'lib/kuzya/commands/add.rb', line 27

def call
  config.add(args)

  puts 'Done.'
end