cleanup cli library structure

This commit is contained in:
Dietmar Maurer 2019-02-21 09:07:25 +01:00
parent 56458d9764
commit 4de0e142a0
8 changed files with 20 additions and 11 deletions

View File

@ -3,7 +3,7 @@ extern crate proxmox_backup;
use failure::*; use failure::*;
use proxmox_backup::tools; use proxmox_backup::tools;
use proxmox_backup::cli::command::*; use proxmox_backup::cli::*;
use proxmox_backup::api_schema::*; use proxmox_backup::api_schema::*;
use proxmox_backup::api_schema::router::*; use proxmox_backup::api_schema::router::*;

View File

@ -5,7 +5,7 @@ use failure::*;
use chrono::{Local, TimeZone}; use chrono::{Local, TimeZone};
use proxmox_backup::tools; use proxmox_backup::tools;
use proxmox_backup::cli::command::*; use proxmox_backup::cli::*;
use proxmox_backup::api_schema::*; use proxmox_backup::api_schema::*;
use proxmox_backup::api_schema::router::*; use proxmox_backup::api_schema::router::*;
use proxmox_backup::client::*; use proxmox_backup::client::*;

View File

@ -1,7 +1,7 @@
extern crate proxmox_backup; extern crate proxmox_backup;
//use proxmox_backup::api2; //use proxmox_backup::api2;
use proxmox_backup::cli::command::*; use proxmox_backup::cli::*;
fn datastore_commands() -> CommandLineInterface { fn datastore_commands() -> CommandLineInterface {

14
src/cli.rs Normal file
View File

@ -0,0 +1,14 @@
//! Tools to create command line parsers
//!
//! We can use Schema deinititions to create command line parsers.
//!
//!
mod environment;
pub use environment::*;
mod command;
pub use command::*;
mod getopts;
pub use getopts::*;

View File

@ -9,7 +9,7 @@ use crate::api_schema::router::*;
//use crate::api_schema::config::*; //use crate::api_schema::config::*;
use super::environment::CliEnvironment; use super::environment::CliEnvironment;
use crate::getopts; use super::getopts;
pub fn print_cli_usage() { pub fn print_cli_usage() {

View File

@ -3,6 +3,7 @@ use crate::api_schema::router::*;
use std::collections::HashMap; use std::collections::HashMap;
use serde_json::Value; use serde_json::Value;
/// `RpcEnvironmet` implementation for command line tools
pub struct CliEnvironment { pub struct CliEnvironment {
result_attributes: HashMap<String, Value>, result_attributes: HashMap<String, Value>,
user: Option<String>, user: Option<String>,

View File

@ -31,16 +31,10 @@ pub mod storage {
pub mod futures; pub mod futures;
} }
pub mod cli { pub mod cli;
pub mod environment;
pub mod command;
}
pub mod api2; pub mod api2;
pub mod client; pub mod client;
pub mod getopts;
pub mod auth_helpers; pub mod auth_helpers;