1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use std::path::PathBuf;
use busylib::StoragePath;
use clap::Subcommand;
use crate::cli::Context;
use crate::error::Result;
#[derive(Debug, Subcommand)]
pub enum StorageCommand {
/// Upload a file to the internal storage
Write {
/// Destination below /ext
#[arg(value_name = "PATH")]
path: StoragePath,
/// Local file to upload, or - for stdin
#[arg(long, short = 'f', value_name = "FILE")]
file: PathBuf,
},
/// Download a file from the internal storage
Read {
/// File to download
#[arg(value_name = "PATH")]
path: StoragePath,
/// Write the file here instead of stdout
#[arg(long, short = 'O', value_name = "FILE")]
output: Option<PathBuf>,
},
/// List a directory on the internal storage
List {
/// Directory to list
#[arg(value_name = "PATH", default_value = "/ext")]
path: StoragePath,
},
/// Remove a file from the internal storage
Remove {
/// File to remove
#[arg(value_name = "PATH")]
path: StoragePath,
},
/// Create a directory on the internal storage
Mkdir {
/// Directory to create
#[arg(value_name = "PATH")]
path: StoragePath,
},
/// Move a file on the internal storage
Rename {
/// Current location
#[arg(value_name = "PATH")]
path: StoragePath,
/// New location
#[arg(value_name = "NEW_PATH")]
new_path: StoragePath,
},
/// Show the storage usage
Status,
}
impl StorageCommand {
pub async fn run(self, _context: &Context) -> Result<()> {
todo!()
}
}