Class: Tuya::Command::Group::GroupCreate

Inherits:
Tuya::Command::Group show all
Defined in:
lib/tycli/command/group/create.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ GroupCreate

Returns a new instance of GroupCreate.



25
26
27
28
# File 'lib/tycli/command/group/create.rb', line 25

def initialize(argv)
	super
	@name = argv.option('name')
end

Class Method Details

.optionsObject



19
20
21
22
23
# File 'lib/tycli/command/group/create.rb', line 19

def self.options
	[
		['--name=group_name', '--name the name for your group']
	]
end

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/tycli/command/group/create.rb', line 9

def run
	puts "group name is #{@name}".green

	require 'tycli/group'
	require 'tycli/config'

	group = Tuya::ConfigGroup.new(@name)
	Tuya::TYGroup.setup_spec group
	Tuya::TYGroup.create_tuya_public_inc_if_need
end

#validate!Object



30
31
32
# File 'lib/tycli/command/group/create.rb', line 30

def validate!
	help! "name need" unless @name
end