feat: add subcommand to dfstore (#17)

This commit is contained in:
Gaius 2023-04-23 15:36:04 +08:00 committed by GitHub
parent 3f1d18abac
commit 3d73b2c27d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 1 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
use clap::Parser;
use clap::{Parser, Subcommand};
use client::config::dfdaemon::default_dfdaemon_unix_socket_path;
use client::config::dfstore::default_dfstore_log_dir;
use std::path::PathBuf;
@ -54,8 +54,41 @@ struct Args {
help = "Specify the log directory"
)]
log_dir: PathBuf,
#[command(subcommand)]
command: Command,
}
#[derive(Debug, Clone, Subcommand)]
#[command()]
pub enum Command {
#[command(
name = "cp",
author,
version,
about = "Download or upload files using object storage in Dragonfly",
long_about = "Download a file from object storage in Dragonfly or upload a local file to object storage in Dragonfly"
)]
Copy(CopyCommand),
#[command(
name = "rm",
author,
version,
about = "Remove a file from Dragonfly object storage",
long_about = "Remove the P2P cache in Dragonfly and remove the file stored in the object storage."
)]
Remove(RemoveCommand),
}
// Download or upload files using object storage in Dragonfly.
#[derive(Debug, Clone, Parser)]
pub struct CopyCommand {}
// Remove a file from Dragonfly object storage.
#[derive(Debug, Clone, Parser)]
pub struct RemoveCommand {}
fn main() {
let args = Args::parse();
print!("{:?}", args.endpoint);