Class: Duse::CLI::FolderAdd

Inherits:
ApiCommand show all
Defined in:
lib/duse/cli/folder_add.rb

Instance Attribute Summary

Attributes inherited from Command

#arguments, #force_interactive, #input, #output

Instance Method Summary collapse

Methods inherited from ApiCommand

#execute, #setup

Methods inherited from Command

abstract, abstract?, #check_arity, #color, #command_name, command_name, #config, description, #error, #execute, #format, #full_command, full_command, has_subcommands?, has_super_command?, #help, #help_subcommands, #initialize, #interactive?, #parse, #say, #setup, skip, subcommand, subcommands, #success, super_command, super_command=, #terminal, #usage, #usage_for, #warn, #write_to, #wrong_args

Methods included from Parser

#new, #on, #on_initialize

Constructor Details

This class inherits a constructor from Duse::CLI::Command

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/duse/cli/folder_add.rb', line 11

def run
  self.name   ||= terminal.ask 'What to you want to call the new folder? '
  self.parent ||= terminal.ask 'What folder do you want this folder to be under? (provide the id) [root] ' 

  Duse::Folder.create(
    name: name,
    parent_id: parent
  )

  success 'Folder successfully created!'
end