221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
# File 'lib/morpheus/cli/commands/library_option_lists_command.rb', line 221
def list_items(args)
params = {}
options = {}
optparse = Morpheus::Cli::OptionParser.new do |opts|
opts.banner = subcommand_usage("[name]")
build_standard_get_options(opts, options)
opts. = "List items for an option list.\n" +
"[name] is required. This is the name or id of an option list."
end
optparse.parse!(args)
verify_args!(args:args, optparse:optparse, count:1)
connect(options)
option_type_list = find_option_type_list_by_name_or_id(args[0])
return 1 if option_type_list.nil?
params.merge!(parse_list_options(options))
@option_type_lists_interface.setopts(options)
if options[:dry_run]
print_dry_run @option_type_lists_interface.dry.list_items(option_type_list['id'], params)
return
end
json_response = @option_type_lists_interface.list_items(option_type_list['id'], params)
list_items = json_response['listItems']
render_response(json_response, options, "listItems") do
print_h2 "List Items"
if list_items && list_items.size > 0
print as_pretty_table(list_items, [:name, :value], options)
({size: list_items.size, total: list_items.size})
else
print cyan,"No list items found.",reset,"\n"
end
print reset,"\n"
end
return 0, nil
end
|