Method: Morpheus::Cli::LibraryFormsCommand#remove

Defined in:
lib/morpheus/cli/commands/library_forms_command.rb

#remove(args) ⇒ Object



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/morpheus/cli/commands/library_forms_command.rb', line 227

def remove(args)
  options = {}
  params = {}
  optparse = Morpheus::Cli::OptionParser.new do |opts|
    opts.banner = subcommand_usage("[form]")
    build_standard_remove_options(opts, options)
    opts.footer = "Delete a form.\n[form] is required. This is the name or id of a form.\n"
  end
  optparse.parse!(args)
  verify_args!(args:args, optparse:optparse, count:1)
  connect(options)
  form = find_option_type_form_by_name_or_id(args[0])
  return 1, "Form not found" if form.nil?
  parse_options(options, params)
  confirm!("Are you sure you want to delete the form #{form['name']}?", options)
  execute_api(@option_type_forms_interface, :destroy, [form['id']], options) do |json_response|
    print_green_success "Removed form #{form['name']}"
  end
end