Class: Tuya::Command::Group::GroupCreate
- Inherits:
-
Tuya::Command::Group
- Object
- CLAide::Command
- Tuya::Command
- Tuya::Command::Group
- Tuya::Command::Group::GroupCreate
- Defined in:
- lib/tycli/command/group/create.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ GroupCreate
constructor
A new instance of GroupCreate.
- #run ⇒ Object
- #validate! ⇒ Object
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
.options ⇒ Object
19 20 21 22 23 |
# File 'lib/tycli/command/group/create.rb', line 19 def self. [ ['--name=group_name', '--name the name for your group'] ] end |
Instance Method Details
#run ⇒ Object
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 |