20 tape
::complete_drive_path
,
23 complete_changer_name
,
24 complete_lto_drive_name
,
28 pub fn drive_commands() -> CommandLineInterface
{
30 let cmd_def
= CliCommandMap
::new()
31 .insert("scan", CliCommand
::new(&API_METHOD_SCAN_FOR_DRIVES
))
32 .insert("list", CliCommand
::new(&API_METHOD_LIST_DRIVES
))
34 CliCommand
::new(&API_METHOD_GET_CONFIG
)
36 .completion_cb("name", complete_lto_drive_name
)
40 CliCommand
::new(&api2
::config
::drive
::API_METHOD_DELETE_DRIVE
)
42 .completion_cb("name", complete_lto_drive_name
)
46 CliCommand
::new(&api2
::config
::drive
::API_METHOD_CREATE_DRIVE
)
48 .completion_cb("name", complete_drive_name
)
49 .completion_cb("path", complete_drive_path
)
50 .completion_cb("changer", complete_changer_name
)
54 CliCommand
::new(&api2
::config
::drive
::API_METHOD_UPDATE_DRIVE
)
56 .completion_cb("name", complete_lto_drive_name
)
57 .completion_cb("path", complete_drive_path
)
58 .completion_cb("changer", complete_changer_name
)
69 schema
: OUTPUT_FORMAT
,
78 rpcenv
: &mut dyn RpcEnvironment
,
79 ) -> Result
<(), Error
> {
81 let output_format
= get_output_format(¶m
);
82 let info
= &api2
::tape
::drive
::API_METHOD_LIST_DRIVES
;
83 let mut data
= match info
.handler
{
84 ApiHandler
::Sync(handler
) => (handler
)(param
, info
, rpcenv
)?
,
88 let options
= default_table_format_options()
89 .column(ColumnConfig
::new("name"))
90 .column(ColumnConfig
::new("path"))
91 .column(ColumnConfig
::new("changer"))
92 .column(ColumnConfig
::new("vendor"))
93 .column(ColumnConfig
::new("model"))
94 .column(ColumnConfig
::new("serial"))
97 format_and_print_result_full(&mut data
, &info
.returns
, &output_format
, &options
);
106 schema
: OUTPUT_FORMAT
,
115 rpcenv
: &mut dyn RpcEnvironment
,
116 ) -> Result
<(), Error
> {
118 let output_format
= get_output_format(¶m
);
119 let info
= &api2
::tape
::API_METHOD_SCAN_DRIVES
;
120 let mut data
= match info
.handler
{
121 ApiHandler
::Sync(handler
) => (handler
)(param
, info
, rpcenv
)?
,
125 let options
= default_table_format_options()
126 .column(ColumnConfig
::new("path"))
127 .column(ColumnConfig
::new("vendor"))
128 .column(ColumnConfig
::new("model"))
129 .column(ColumnConfig
::new("serial"))
132 format_and_print_result_full(&mut data
, &info
.returns
, &output_format
, &options
);
142 schema
: OUTPUT_FORMAT
,
146 schema
: DRIVE_NAME_SCHEMA
,
151 /// Get pool configuration
154 rpcenv
: &mut dyn RpcEnvironment
,
155 ) -> Result
<(), Error
> {
157 let output_format
= get_output_format(¶m
);
158 let info
= &api2
::config
::drive
::API_METHOD_GET_CONFIG
;
159 let mut data
= match info
.handler
{
160 ApiHandler
::Sync(handler
) => (handler
)(param
, info
, rpcenv
)?
,
164 let options
= default_table_format_options()
165 .column(ColumnConfig
::new("name"))
166 .column(ColumnConfig
::new("path"))
167 .column(ColumnConfig
::new("changer"))
168 .column(ColumnConfig
::new("changer-drivenum"))
171 format_and_print_result_full(&mut data
, &info
.returns
, &output_format
, &options
);