use complete_file_name from proxmox-router 1.1
This commit is contained in:
		| @ -100,7 +100,7 @@ proxmox = { version = "0.14.0", features = [ "sortable-macro" ] } | |||||||
| proxmox-http = { version = "0.5.0", features = [ "client", "http-helpers", "websocket" ] } | proxmox-http = { version = "0.5.0", features = [ "client", "http-helpers", "websocket" ] } | ||||||
| proxmox-io = "1" | proxmox-io = "1" | ||||||
| proxmox-lang = "1" | proxmox-lang = "1" | ||||||
| proxmox-router = { version = "1", features = [ "cli" ] } | proxmox-router = { version = "1.1", features = [ "cli" ] } | ||||||
| proxmox-schema = { version = "1", features = [ "api-macro" ] } | proxmox-schema = { version = "1", features = [ "api-macro" ] } | ||||||
| proxmox-section-config = "1" | proxmox-section-config = "1" | ||||||
| proxmox-tfa = { version = "1", features = [ "u2f" ] } | proxmox-tfa = { version = "1", features = [ "u2f" ] } | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ proxmox-fuse = "0.1.1" | |||||||
| proxmox-http = { version = "0.5.0", features = [ "client", "http-helpers", "websocket" ] } | proxmox-http = { version = "0.5.0", features = [ "client", "http-helpers", "websocket" ] } | ||||||
| proxmox-io = { version = "1", features = [ "tokio" ] } | proxmox-io = { version = "1", features = [ "tokio" ] } | ||||||
| proxmox-lang = "1" | proxmox-lang = "1" | ||||||
| proxmox-router = { version = "1", features = [ "cli" ] } | proxmox-router = { version = "1.1", features = [ "cli" ] } | ||||||
| proxmox-schema = "1" | proxmox-schema = "1" | ||||||
| proxmox-time = "1" | proxmox-time = "1" | ||||||
| pxar = { version = "0.10.1", features = [ "tokio-io" ] } | pxar = { version = "0.10.1", features = [ "tokio-io" ] } | ||||||
|  | |||||||
| @ -79,13 +79,13 @@ pub fn catalog_shell_cli() -> CommandLineInterface { | |||||||
|                 "restore-selected", |                 "restore-selected", | ||||||
|                 CliCommand::new(&API_METHOD_RESTORE_SELECTED_COMMAND) |                 CliCommand::new(&API_METHOD_RESTORE_SELECTED_COMMAND) | ||||||
|                     .arg_param(&["target"]) |                     .arg_param(&["target"]) | ||||||
|                     .completion_cb("target", pbs_tools::fs::complete_file_name), |                     .completion_cb("target", cli::complete_file_name), | ||||||
|             ) |             ) | ||||||
|             .insert( |             .insert( | ||||||
|                 "restore", |                 "restore", | ||||||
|                 CliCommand::new(&API_METHOD_RESTORE_COMMAND) |                 CliCommand::new(&API_METHOD_RESTORE_COMMAND) | ||||||
|                     .arg_param(&["target"]) |                     .arg_param(&["target"]) | ||||||
|                     .completion_cb("target", pbs_tools::fs::complete_file_name), |                     .completion_cb("target", cli::complete_file_name), | ||||||
|             ) |             ) | ||||||
|             .insert( |             .insert( | ||||||
|                 "find", |                 "find", | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ use serde_json::{json, Value}; | |||||||
| use xdg::BaseDirectories; | use xdg::BaseDirectories; | ||||||
|  |  | ||||||
| use proxmox_schema::*; | use proxmox_schema::*; | ||||||
| use proxmox_router::cli::shellword_split; | use proxmox_router::cli::{complete_file_name, shellword_split}; | ||||||
| use proxmox::tools::fs::file_get_json; | use proxmox::tools::fs::file_get_json; | ||||||
|  |  | ||||||
| use pbs_api_types::{BACKUP_REPO_URL, Authid, UserWithTokens}; | use pbs_api_types::{BACKUP_REPO_URL, Authid, UserWithTokens}; | ||||||
| @ -411,7 +411,7 @@ pub fn complete_backup_source(arg: &str, param: &HashMap<String, String>) -> Vec | |||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     let files = pbs_tools::fs::complete_file_name(data[1], param); |     let files = complete_file_name(data[1], param); | ||||||
|  |  | ||||||
|     for file in files { |     for file in files { | ||||||
|         result.push(format!("{}:{}", data[0], file)); |         result.push(format!("{}:{}", data[0], file)); | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ serde_json = "1.0" | |||||||
|  |  | ||||||
| proxmox = "0.14.0" | proxmox = "0.14.0" | ||||||
| proxmox-lang = "1" | proxmox-lang = "1" | ||||||
| proxmox-router = { version = "1", default-features = false } | proxmox-router = { version = "1.1", default-features = false } | ||||||
| proxmox-schema = "1" | proxmox-schema = "1" | ||||||
| proxmox-section-config = "1" | proxmox-section-config = "1" | ||||||
| proxmox-time = "1" | proxmox-time = "1" | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ proxmox-time = "1" | |||||||
| proxmox-uuid = "1" | proxmox-uuid = "1" | ||||||
|  |  | ||||||
| # router::cli is only used by binaries, so maybe we should split them out | # router::cli is only used by binaries, so maybe we should split them out | ||||||
| proxmox-router = "1" | proxmox-router = "1.1" | ||||||
|  |  | ||||||
| pbs-api-types = { path = "../pbs-api-types" } | pbs-api-types = { path = "../pbs-api-types" } | ||||||
| pbs-tools = { path = "../pbs-tools" } | pbs-tools = { path = "../pbs-tools" } | ||||||
|  | |||||||
| @ -1,9 +1,7 @@ | |||||||
| //! File system helper utilities. | //! File system helper utilities. | ||||||
|  |  | ||||||
| use std::borrow::{Borrow, BorrowMut}; | use std::borrow::{Borrow, BorrowMut}; | ||||||
| use std::collections::HashMap; |  | ||||||
| use std::fs::File; | use std::fs::File; | ||||||
| use std::hash::BuildHasher; |  | ||||||
| use std::io::{self, BufRead}; | use std::io::{self, BufRead}; | ||||||
| use std::ops::{Deref, DerefMut}; | use std::ops::{Deref, DerefMut}; | ||||||
| use std::os::unix::io::{AsRawFd, RawFd}; | use std::os::unix::io::{AsRawFd, RawFd}; | ||||||
| @ -12,7 +10,7 @@ use std::path::Path; | |||||||
| use anyhow::{bail, format_err, Error}; | use anyhow::{bail, format_err, Error}; | ||||||
| use nix::dir; | use nix::dir; | ||||||
| use nix::dir::Dir; | use nix::dir::Dir; | ||||||
| use nix::fcntl::{AtFlags, OFlag}; | use nix::fcntl::OFlag; | ||||||
| use nix::sys::stat::Mode; | use nix::sys::stat::Mode; | ||||||
|  |  | ||||||
| use regex::Regex; | use regex::Regex; | ||||||
| @ -350,61 +348,6 @@ fn do_lock_dir_noblock( | |||||||
|     Ok(handle) |     Ok(handle) | ||||||
| } | } | ||||||
|  |  | ||||||
| pub fn complete_file_name<S>(arg: &str, _param: &HashMap<String, String, S>) -> Vec<String> |  | ||||||
| where |  | ||||||
|     S: BuildHasher, |  | ||||||
| { |  | ||||||
|     let mut result = vec![]; |  | ||||||
|  |  | ||||||
|     let mut dirname = std::path::PathBuf::from(if arg.is_empty() { "./" } else { arg }); |  | ||||||
|  |  | ||||||
|     let is_dir = match nix::sys::stat::fstatat(libc::AT_FDCWD, &dirname, AtFlags::empty()) { |  | ||||||
|         Ok(stat) => (stat.st_mode & libc::S_IFMT) == libc::S_IFDIR, |  | ||||||
|         Err(_) => false, |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     if !is_dir { |  | ||||||
|         if let Some(parent) = dirname.parent() { |  | ||||||
|             dirname = parent.to_owned(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     let mut dir = |  | ||||||
|         match nix::dir::Dir::openat(libc::AT_FDCWD, &dirname, OFlag::O_DIRECTORY, Mode::empty()) { |  | ||||||
|             Ok(d) => d, |  | ||||||
|             Err(_) => return result, |  | ||||||
|         }; |  | ||||||
|  |  | ||||||
|     for item in dir.iter() { |  | ||||||
|         if let Ok(entry) = item { |  | ||||||
|             if let Ok(name) = entry.file_name().to_str() { |  | ||||||
|                 if name == "." || name == ".." { |  | ||||||
|                     continue; |  | ||||||
|                 } |  | ||||||
|                 let mut newpath = dirname.clone(); |  | ||||||
|                 newpath.push(name); |  | ||||||
|  |  | ||||||
|                 if let Ok(stat) = |  | ||||||
|                     nix::sys::stat::fstatat(libc::AT_FDCWD, &newpath, AtFlags::empty()) |  | ||||||
|                 { |  | ||||||
|                     if (stat.st_mode & libc::S_IFMT) == libc::S_IFDIR { |  | ||||||
|                         newpath.push(""); |  | ||||||
|                         if let Some(newpath) = newpath.to_str() { |  | ||||||
|                             result.push(newpath.to_owned()); |  | ||||||
|                         } |  | ||||||
|                         continue; |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|                 if let Some(newpath) = newpath.to_str() { |  | ||||||
|                     result.push(newpath.to_owned()); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     result |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /// Get an iterator over lines of a file, skipping empty lines and comments (lines starting with a | /// Get an iterator over lines of a file, skipping empty lines and comments (lines starting with a | ||||||
| /// `#`). | /// `#`). | ||||||
| pub fn file_get_non_comment_lines<P: AsRef<Path>>( | pub fn file_get_non_comment_lines<P: AsRef<Path>>( | ||||||
|  | |||||||
| @ -23,7 +23,7 @@ pathpatterns = "0.1.2" | |||||||
| pxar = { version = "0.10.1", features = [ "tokio-io" ] } | pxar = { version = "0.10.1", features = [ "tokio-io" ] } | ||||||
|  |  | ||||||
| proxmox = { version = "0.14.0", features = [ "sortable-macro" ] } | proxmox = { version = "0.14.0", features = [ "sortable-macro" ] } | ||||||
| proxmox-router = { version = "1", features = [ "cli" ] } | proxmox-router = { version = "1.1", features = [ "cli" ] } | ||||||
| proxmox-schema = { version = "1", features = [ "api-macro" ] } | proxmox-schema = { version = "1", features = [ "api-macro" ] } | ||||||
| proxmox-time = "1" | proxmox-time = "1" | ||||||
|  |  | ||||||
|  | |||||||
| @ -7,7 +7,8 @@ use serde_json::Value; | |||||||
| use proxmox::sys::linux::tty; | use proxmox::sys::linux::tty; | ||||||
| use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions}; | use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions}; | ||||||
| use proxmox_router::cli::{ | use proxmox_router::cli::{ | ||||||
|     format_and_print_result_full, get_output_format, CliCommand, CliCommandMap, ColumnConfig, |     complete_file_name, format_and_print_result_full, get_output_format, | ||||||
|  |     CliCommand, CliCommandMap, ColumnConfig, | ||||||
|     OUTPUT_FORMAT, |     OUTPUT_FORMAT, | ||||||
| }; | }; | ||||||
| use proxmox_schema::{api, ApiType, ReturnType}; | use proxmox_schema::{api, ApiType, ReturnType}; | ||||||
| @ -451,35 +452,35 @@ fn paper_key( | |||||||
| pub fn cli() -> CliCommandMap { | pub fn cli() -> CliCommandMap { | ||||||
|     let key_create_cmd_def = CliCommand::new(&API_METHOD_CREATE) |     let key_create_cmd_def = CliCommand::new(&API_METHOD_CREATE) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|  |  | ||||||
|     let key_import_with_master_key_cmd_def = CliCommand::new(&API_METHOD_IMPORT_WITH_MASTER_KEY) |     let key_import_with_master_key_cmd_def = CliCommand::new(&API_METHOD_IMPORT_WITH_MASTER_KEY) | ||||||
|         .arg_param(&["master-keyfile"]) |         .arg_param(&["master-keyfile"]) | ||||||
|         .completion_cb("master-keyfile", pbs_tools::fs::complete_file_name) |         .completion_cb("master-keyfile", complete_file_name) | ||||||
|         .arg_param(&["encrypted-keyfile"]) |         .arg_param(&["encrypted-keyfile"]) | ||||||
|         .completion_cb("encrypted-keyfile", pbs_tools::fs::complete_file_name) |         .completion_cb("encrypted-keyfile", complete_file_name) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|  |  | ||||||
|     let key_change_passphrase_cmd_def = CliCommand::new(&API_METHOD_CHANGE_PASSPHRASE) |     let key_change_passphrase_cmd_def = CliCommand::new(&API_METHOD_CHANGE_PASSPHRASE) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|  |  | ||||||
|     let key_create_master_key_cmd_def = CliCommand::new(&API_METHOD_CREATE_MASTER_KEY); |     let key_create_master_key_cmd_def = CliCommand::new(&API_METHOD_CREATE_MASTER_KEY); | ||||||
|     let key_import_master_pubkey_cmd_def = CliCommand::new(&API_METHOD_IMPORT_MASTER_PUBKEY) |     let key_import_master_pubkey_cmd_def = CliCommand::new(&API_METHOD_IMPORT_MASTER_PUBKEY) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|     let key_show_master_pubkey_cmd_def = CliCommand::new(&API_METHOD_SHOW_MASTER_PUBKEY) |     let key_show_master_pubkey_cmd_def = CliCommand::new(&API_METHOD_SHOW_MASTER_PUBKEY) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|  |  | ||||||
|     let key_show_cmd_def = CliCommand::new(&API_METHOD_SHOW_KEY) |     let key_show_cmd_def = CliCommand::new(&API_METHOD_SHOW_KEY) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|  |  | ||||||
|     let paper_key_cmd_def = CliCommand::new(&API_METHOD_PAPER_KEY) |     let paper_key_cmd_def = CliCommand::new(&API_METHOD_PAPER_KEY) | ||||||
|         .arg_param(&["path"]) |         .arg_param(&["path"]) | ||||||
|         .completion_cb("path", pbs_tools::fs::complete_file_name); |         .completion_cb("path", complete_file_name); | ||||||
|  |  | ||||||
|     CliCommandMap::new() |     CliCommandMap::new() | ||||||
|         .insert("create", key_create_cmd_def) |         .insert("create", key_create_cmd_def) | ||||||
|  | |||||||
| @ -1429,13 +1429,13 @@ fn main() { | |||||||
|         .arg_param(&["backupspec"]) |         .arg_param(&["backupspec"]) | ||||||
|         .completion_cb("repository", complete_repository) |         .completion_cb("repository", complete_repository) | ||||||
|         .completion_cb("backupspec", complete_backup_source) |         .completion_cb("backupspec", complete_backup_source) | ||||||
|         .completion_cb("keyfile", pbs_tools::fs::complete_file_name) |         .completion_cb("keyfile", complete_file_name) | ||||||
|         .completion_cb("master-pubkey-file", pbs_tools::fs::complete_file_name) |         .completion_cb("master-pubkey-file", complete_file_name) | ||||||
|         .completion_cb("chunk-size", complete_chunk_size); |         .completion_cb("chunk-size", complete_chunk_size); | ||||||
|  |  | ||||||
|     let benchmark_cmd_def = CliCommand::new(&API_METHOD_BENCHMARK) |     let benchmark_cmd_def = CliCommand::new(&API_METHOD_BENCHMARK) | ||||||
|         .completion_cb("repository", complete_repository) |         .completion_cb("repository", complete_repository) | ||||||
|         .completion_cb("keyfile", pbs_tools::fs::complete_file_name); |         .completion_cb("keyfile", complete_file_name); | ||||||
|  |  | ||||||
|     let list_cmd_def = CliCommand::new(&API_METHOD_LIST_BACKUP_GROUPS) |     let list_cmd_def = CliCommand::new(&API_METHOD_LIST_BACKUP_GROUPS) | ||||||
|         .completion_cb("repository", complete_repository); |         .completion_cb("repository", complete_repository); | ||||||
| @ -1448,7 +1448,7 @@ fn main() { | |||||||
|         .completion_cb("repository", complete_repository) |         .completion_cb("repository", complete_repository) | ||||||
|         .completion_cb("snapshot", complete_group_or_snapshot) |         .completion_cb("snapshot", complete_group_or_snapshot) | ||||||
|         .completion_cb("archive-name", complete_archive_name) |         .completion_cb("archive-name", complete_archive_name) | ||||||
|         .completion_cb("target", pbs_tools::fs::complete_file_name); |         .completion_cb("target", complete_file_name); | ||||||
|  |  | ||||||
|     let prune_cmd_def = CliCommand::new(&API_METHOD_PRUNE) |     let prune_cmd_def = CliCommand::new(&API_METHOD_PRUNE) | ||||||
|         .arg_param(&["group"]) |         .arg_param(&["group"]) | ||||||
|  | |||||||
| @ -94,7 +94,7 @@ pub fn mount_cmd_def() -> CliCommand { | |||||||
|         .completion_cb("repository", complete_repository) |         .completion_cb("repository", complete_repository) | ||||||
|         .completion_cb("snapshot", complete_group_or_snapshot) |         .completion_cb("snapshot", complete_group_or_snapshot) | ||||||
|         .completion_cb("archive-name", complete_pxar_archive_name) |         .completion_cb("archive-name", complete_pxar_archive_name) | ||||||
|         .completion_cb("target", pbs_tools::fs::complete_file_name) |         .completion_cb("target", complete_file_name) | ||||||
| } | } | ||||||
|  |  | ||||||
| pub fn map_cmd_def() -> CliCommand { | pub fn map_cmd_def() -> CliCommand { | ||||||
|  | |||||||
| @ -403,8 +403,8 @@ pub fn snapshot_mgtm_cli() -> CliCommandMap { | |||||||
|             CliCommand::new(&API_METHOD_UPLOAD_LOG) |             CliCommand::new(&API_METHOD_UPLOAD_LOG) | ||||||
|                 .arg_param(&["snapshot", "logfile"]) |                 .arg_param(&["snapshot", "logfile"]) | ||||||
|                 .completion_cb("snapshot", complete_backup_snapshot) |                 .completion_cb("snapshot", complete_backup_snapshot) | ||||||
|                 .completion_cb("logfile", pbs_tools::fs::complete_file_name) |                 .completion_cb("logfile", complete_file_name) | ||||||
|                 .completion_cb("keyfile", pbs_tools::fs::complete_file_name) |                 .completion_cb("keyfile", complete_file_name) | ||||||
|                 .completion_cb("repository", complete_repository) |                 .completion_cb("repository", complete_repository) | ||||||
|         ) |         ) | ||||||
| } | } | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ pxar = { version = "0.10.1", features = [ "tokio-io" ] } | |||||||
|  |  | ||||||
| proxmox = { version = "0.14.0" } | proxmox = { version = "0.14.0" } | ||||||
| proxmox-lang = "1" | proxmox-lang = "1" | ||||||
| proxmox-router = { version = "1", features = [ "cli" ] } | proxmox-router = { version = "1.1", features = [ "cli" ] } | ||||||
| proxmox-schema = { version = "1", features = [ "api-macro" ] } | proxmox-schema = { version = "1", features = [ "api-macro" ] } | ||||||
| proxmox-time = "1" | proxmox-time = "1" | ||||||
| proxmox-uuid = "1" | proxmox-uuid = "1" | ||||||
|  | |||||||
| @ -8,8 +8,10 @@ use serde_json::{json, Value}; | |||||||
|  |  | ||||||
| use proxmox::tools::fs::{create_path, CreateOptions}; | use proxmox::tools::fs::{create_path, CreateOptions}; | ||||||
| use proxmox_router::cli::{ | use proxmox_router::cli::{ | ||||||
|     default_table_format_options, format_and_print_result_full, get_output_format, |     complete_file_name, default_table_format_options, | ||||||
|     run_cli_command, CliCommand, CliCommandMap, CliEnvironment, ColumnConfig, OUTPUT_FORMAT, |     format_and_print_result_full, get_output_format, | ||||||
|  |     run_cli_command, | ||||||
|  |     CliCommand, CliCommandMap, CliEnvironment, ColumnConfig, OUTPUT_FORMAT, | ||||||
| }; | }; | ||||||
| use proxmox_schema::api; | use proxmox_schema::api; | ||||||
| use pxar::accessor::aio::Accessor; | use pxar::accessor::aio::Accessor; | ||||||
| @ -459,7 +461,7 @@ fn main() { | |||||||
|         .arg_param(&["snapshot", "path", "target"]) |         .arg_param(&["snapshot", "path", "target"]) | ||||||
|         .completion_cb("repository", complete_repository) |         .completion_cb("repository", complete_repository) | ||||||
|         .completion_cb("snapshot", complete_group_or_snapshot) |         .completion_cb("snapshot", complete_group_or_snapshot) | ||||||
|         .completion_cb("target", pbs_tools::fs::complete_file_name); |         .completion_cb("target", complete_file_name); | ||||||
|  |  | ||||||
|     let status_cmd_def = CliCommand::new(&API_METHOD_STATUS); |     let status_cmd_def = CliCommand::new(&API_METHOD_STATUS); | ||||||
|     let stop_cmd_def = CliCommand::new(&API_METHOD_STOP) |     let stop_cmd_def = CliCommand::new(&API_METHOD_STOP) | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ url = "2.1" | |||||||
| proxmox = "0.14.0" | proxmox = "0.14.0" | ||||||
| proxmox-io = "1" | proxmox-io = "1" | ||||||
| proxmox-lang = "1" | proxmox-lang = "1" | ||||||
| proxmox-router = "1" | proxmox-router = "1.1" | ||||||
| proxmox-schema = { version = "1", features = [ "api-macro", "upid-api-impl" ] } | proxmox-schema = { version = "1", features = [ "api-macro", "upid-api-impl" ] } | ||||||
| proxmox-time = "1" | proxmox-time = "1" | ||||||
|  |  | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ pathpatterns = "0.1.2" | |||||||
| pxar = { version = "0.10.1", features = [ "tokio-io" ] } | pxar = { version = "0.10.1", features = [ "tokio-io" ] } | ||||||
|  |  | ||||||
| proxmox = { version = "0.14.0", features = [ "sortable-macro" ] } | proxmox = { version = "0.14.0", features = [ "sortable-macro" ] } | ||||||
| proxmox-router = { version = "1", features = [ "cli" ] } | proxmox-router = { version = "1.1", features = [ "cli" ] } | ||||||
| proxmox-schema = { version = "1", features = [ "api-macro" ] } | proxmox-schema = { version = "1", features = [ "api-macro" ] } | ||||||
| proxmox-time = "1" | proxmox-time = "1" | ||||||
|  |  | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ edition = "2018" | |||||||
| description = "Simple RRD database implementation." | description = "Simple RRD database implementation." | ||||||
|  |  | ||||||
| [dev-dependencies] | [dev-dependencies] | ||||||
| proxmox-router = "1" | proxmox-router = "1.1" | ||||||
|  |  | ||||||
| [dependencies] | [dependencies] | ||||||
| anyhow = "1.0" | anyhow = "1.0" | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ use serde::{Serialize, Deserialize}; | |||||||
| use serde_json::json; | use serde_json::json; | ||||||
|  |  | ||||||
| use proxmox_router::RpcEnvironment; | use proxmox_router::RpcEnvironment; | ||||||
| use proxmox_router::cli::{run_cli_command, CliCommand, CliCommandMap, CliEnvironment}; | use proxmox_router::cli::{run_cli_command, complete_file_name, CliCommand, CliCommandMap, CliEnvironment}; | ||||||
| use proxmox_schema::{api, parse_property_string}; | use proxmox_schema::{api, parse_property_string}; | ||||||
| use proxmox_schema::{ApiStringFormat, ApiType, IntegerSchema, Schema, StringSchema}; | use proxmox_schema::{ApiStringFormat, ApiType, IntegerSchema, Schema, StringSchema}; | ||||||
|  |  | ||||||
| @ -350,55 +350,55 @@ fn main() -> Result<(), Error> { | |||||||
|             "create", |             "create", | ||||||
|             CliCommand::new(&API_METHOD_CREATE_RRD) |             CliCommand::new(&API_METHOD_CREATE_RRD) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|                 //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "dump", |             "dump", | ||||||
|             CliCommand::new(&API_METHOD_DUMP_RRD) |             CliCommand::new(&API_METHOD_DUMP_RRD) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|                 //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|          ) |          ) | ||||||
|         .insert( |         .insert( | ||||||
|             "fetch", |             "fetch", | ||||||
|             CliCommand::new(&API_METHOD_FETCH_RRD) |             CliCommand::new(&API_METHOD_FETCH_RRD) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|                 //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|          ) |          ) | ||||||
|         .insert( |         .insert( | ||||||
|             "first", |             "first", | ||||||
|             CliCommand::new(&API_METHOD_FIRST_UPDATE_TIME) |             CliCommand::new(&API_METHOD_FIRST_UPDATE_TIME) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|                 //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "info", |             "info", | ||||||
|             CliCommand::new(&API_METHOD_RRD_INFO) |             CliCommand::new(&API_METHOD_RRD_INFO) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|                 //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "last", |             "last", | ||||||
|             CliCommand::new(&API_METHOD_LAST_UPDATE_TIME) |             CliCommand::new(&API_METHOD_LAST_UPDATE_TIME) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|             //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "lastupdate", |             "lastupdate", | ||||||
|             CliCommand::new(&API_METHOD_LAST_UPDATE) |             CliCommand::new(&API_METHOD_LAST_UPDATE) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|             //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "resize", |             "resize", | ||||||
|             CliCommand::new(&API_METHOD_RESIZE_RRD) |             CliCommand::new(&API_METHOD_RESIZE_RRD) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|             //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "update", |             "update", | ||||||
|             CliCommand::new(&API_METHOD_UPDATE_RRD) |             CliCommand::new(&API_METHOD_UPDATE_RRD) | ||||||
|                 .arg_param(&["path"]) |                 .arg_param(&["path"]) | ||||||
|             //.completion_cb("path", pbs_tools::fs::complete_file_name) |                 .completion_cb("path", complete_file_name) | ||||||
|         ) |         ) | ||||||
|         ; |         ; | ||||||
|  |  | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ tokio = { version = "1.6", features = [ "rt", "rt-multi-thread" ] } | |||||||
| pathpatterns = "0.1.2" | pathpatterns = "0.1.2" | ||||||
| proxmox = "0.14.0" | proxmox = "0.14.0" | ||||||
| proxmox-schema = { version = "1", features = [ "api-macro" ] } | proxmox-schema = { version = "1", features = [ "api-macro" ] } | ||||||
| proxmox-router = "1" | proxmox-router = "1.1" | ||||||
| pxar = { version = "0.10.1", features = [ "tokio-io" ] } | pxar = { version = "0.10.1", features = [ "tokio-io" ] } | ||||||
|  |  | ||||||
| pbs-client = { path = "../pbs-client" } | pbs-client = { path = "../pbs-client" } | ||||||
|  | |||||||
| @ -461,29 +461,29 @@ fn main() { | |||||||
|             "create", |             "create", | ||||||
|             CliCommand::new(&API_METHOD_CREATE_ARCHIVE) |             CliCommand::new(&API_METHOD_CREATE_ARCHIVE) | ||||||
|                 .arg_param(&["archive", "source"]) |                 .arg_param(&["archive", "source"]) | ||||||
|                 .completion_cb("archive", pbs_tools::fs::complete_file_name) |                 .completion_cb("archive", complete_file_name) | ||||||
|                 .completion_cb("source", pbs_tools::fs::complete_file_name), |                 .completion_cb("source", complete_file_name), | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "extract", |             "extract", | ||||||
|             CliCommand::new(&API_METHOD_EXTRACT_ARCHIVE) |             CliCommand::new(&API_METHOD_EXTRACT_ARCHIVE) | ||||||
|                 .arg_param(&["archive", "target"]) |                 .arg_param(&["archive", "target"]) | ||||||
|                 .completion_cb("archive", pbs_tools::fs::complete_file_name) |                 .completion_cb("archive", complete_file_name) | ||||||
|                 .completion_cb("target", pbs_tools::fs::complete_file_name) |                 .completion_cb("target", complete_file_name) | ||||||
|                 .completion_cb("files-from", pbs_tools::fs::complete_file_name), |                 .completion_cb("files-from", complete_file_name), | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "mount", |             "mount", | ||||||
|             CliCommand::new(&API_METHOD_MOUNT_ARCHIVE) |             CliCommand::new(&API_METHOD_MOUNT_ARCHIVE) | ||||||
|                 .arg_param(&["archive", "mountpoint"]) |                 .arg_param(&["archive", "mountpoint"]) | ||||||
|                 .completion_cb("archive", pbs_tools::fs::complete_file_name) |                 .completion_cb("archive", complete_file_name) | ||||||
|                 .completion_cb("mountpoint", pbs_tools::fs::complete_file_name), |                 .completion_cb("mountpoint", complete_file_name), | ||||||
|         ) |         ) | ||||||
|         .insert( |         .insert( | ||||||
|             "list", |             "list", | ||||||
|             CliCommand::new(&API_METHOD_DUMP_ARCHIVE) |             CliCommand::new(&API_METHOD_DUMP_ARCHIVE) | ||||||
|                 .arg_param(&["archive"]) |                 .arg_param(&["archive"]) | ||||||
|                 .completion_cb("archive", pbs_tools::fs::complete_file_name), |                 .completion_cb("archive", complete_file_name), | ||||||
|         ); |         ); | ||||||
|  |  | ||||||
|     let rpcenv = CliEnvironment::new(); |     let rpcenv = CliEnvironment::new(); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user