}
});
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+ let output_format = get_output_format(¶m);
let mut result = vec![];
let repo = extract_repository_from_value(¶m)?;
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+ let output_format = get_output_format(¶m);
let client = connect(repo.host(), repo.user())?;
Ok(tools::join(&files, ' '))
};
- let options = TableFormatOptions::new()
- .noborder(false)
- .noheader(false)
+ let options = default_table_format_options()
.sortby("backup-type", false)
.sortby("backup-id", false)
.sortby("backup-time", false)
let path = tools::required_string_param(¶m, "snapshot")?;
let snapshot = BackupDir::parse(path)?;
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+ let output_format = get_output_format(¶m);
let client = connect(repo.host(), repo.user())?;
let mut data: Value = result["data"].take();
- let options = TableFormatOptions::new()
- .noborder(false)
- .noheader(false);
+ let options = default_table_format_options();
format_and_print_result_full(&mut data, info, &output_format, &options);
async fn start_garbage_collection(param: Value) -> Result<Value, Error> {
let repo = extract_repository_from_value(¶m)?;
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+
+ let output_format = get_output_format(¶m);
let mut client = connect(repo.host(), repo.user())?;
let group = tools::required_string_param(¶m, "group")?;
let group = BackupGroup::parse(group)?;
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+
+ let output_format = get_output_format(¶m);
param.as_object_mut().unwrap().remove("repository");
param.as_object_mut().unwrap().remove("group");
let repo = extract_repository_from_value(¶m)?;
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+ let output_format = get_output_format(¶m);
let client = connect(repo.host(), repo.user())?;
Ok(format!("{} {:>8}", v, info))
};
- let options = TableFormatOptions::new()
- .noborder(false)
+ let options = default_table_format_options()
.noheader(true)
.column(ColumnConfig::new("total").renderer(render_total_percentage))
.column(ColumnConfig::new("used").renderer(render_total_percentage))
/// List running server tasks for this repo user
async fn task_list(param: Value) -> Result<Value, Error> {
- let output_format = param["output-format"].as_str().unwrap_or("text").to_owned();
+ let output_format = get_output_format(¶m);
+
let repo = extract_repository_from_value(¶m)?;
let client = connect(repo.host(), repo.user())?;