src/bin/proxmox-backup-manager.rs: format datastore list output
This commit is contained in:
		@ -18,7 +18,19 @@ use crate::config::acl::{PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_ALLOCATE};
 | 
				
			|||||||
        description: "List the configured datastores (with config digest).",
 | 
					        description: "List the configured datastores (with config digest).",
 | 
				
			||||||
        type: Array,
 | 
					        type: Array,
 | 
				
			||||||
        items: {
 | 
					        items: {
 | 
				
			||||||
            type: datastore::DataStoreConfig,
 | 
					            description: "Datastore configuration.",
 | 
				
			||||||
 | 
					            properties: {
 | 
				
			||||||
 | 
					                name: {
 | 
				
			||||||
 | 
					                    schema: DATASTORE_SCHEMA,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                path: {
 | 
				
			||||||
 | 
					                    schema: datastore::DIR_NAME_SCHEMA,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                comment: {
 | 
				
			||||||
 | 
					                    optional: true,
 | 
				
			||||||
 | 
					                    schema: SINGLE_LINE_COMMENT_SCHEMA,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    access: {
 | 
					    access: {
 | 
				
			||||||
 | 
				
			|||||||
@ -288,10 +288,41 @@ fn network_commands() -> CommandLineInterface {
 | 
				
			|||||||
    cmd_def.into()
 | 
					    cmd_def.into()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[api(
 | 
				
			||||||
 | 
					    input: {
 | 
				
			||||||
 | 
					        properties: {
 | 
				
			||||||
 | 
					            "output-format": {
 | 
				
			||||||
 | 
					                schema: OUTPUT_FORMAT,
 | 
				
			||||||
 | 
					                optional: true,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					)]
 | 
				
			||||||
 | 
					/// Datastore list.
 | 
				
			||||||
 | 
					fn list_datastores(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let output_format = get_output_format(¶m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let info = &api2::config::datastore::API_METHOD_LIST_DATASTORES;
 | 
				
			||||||
 | 
					    let mut data = match info.handler {
 | 
				
			||||||
 | 
					        ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
 | 
				
			||||||
 | 
					        _ => unreachable!(),
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let options = default_table_format_options()
 | 
				
			||||||
 | 
					        .column(ColumnConfig::new("name"))
 | 
				
			||||||
 | 
					        .column(ColumnConfig::new("path"))
 | 
				
			||||||
 | 
					        .column(ColumnConfig::new("comment"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    format_and_print_result_full(&mut data, info.returns, &output_format, &options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Ok(Value::Null)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn datastore_commands() -> CommandLineInterface {
 | 
					fn datastore_commands() -> CommandLineInterface {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let cmd_def = CliCommandMap::new()
 | 
					    let cmd_def = CliCommandMap::new()
 | 
				
			||||||
        .insert("list", CliCommand::new(&api2::config::datastore::API_METHOD_LIST_DATASTORES))
 | 
					        .insert("list", CliCommand::new(&API_METHOD_LIST_DATASTORES))
 | 
				
			||||||
        .insert("create",
 | 
					        .insert("create",
 | 
				
			||||||
                CliCommand::new(&api2::config::datastore::API_METHOD_CREATE_DATASTORE)
 | 
					                CliCommand::new(&api2::config::datastore::API_METHOD_CREATE_DATASTORE)
 | 
				
			||||||
                .arg_param(&["name", "path"])
 | 
					                .arg_param(&["name", "path"])
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user