mirror of
https://github.com/qwjyh/xdbm
synced 2024-11-22 14:50:12 +09:00
new: method for storage list
This commit is contained in:
parent
2f9fa08cf2
commit
71e3cad6da
3 changed files with 21 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
# TODO:
|
# TODO:
|
||||||
|
- [ ] split subcommands to functions
|
||||||
- [ ] reorganize cmd option for storage
|
- [ ] reorganize cmd option for storage
|
||||||
- [ ] use subcommand
|
- [ ] use subcommand
|
||||||
|
|
|
@ -373,6 +373,7 @@ fn main() -> Result<()> {
|
||||||
for (k, storage) in &storages {
|
for (k, storage) in &storages {
|
||||||
println!("{}: {}", k, storage);
|
println!("{}: {}", k, storage);
|
||||||
println!(" {}", storage.mount_path(&device, &storages)?.display());
|
println!(" {}", storage.mount_path(&device, &storages)?.display());
|
||||||
|
// println!("{}: {}", storage.shorttypename(), storage.name()); // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StorageCommands::Bind {
|
StorageCommands::Bind {
|
||||||
|
|
|
@ -27,7 +27,25 @@ pub enum Storage {
|
||||||
Online(OnlineStorage),
|
Online(OnlineStorage),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Storage {}
|
impl Storage {
|
||||||
|
/// Full type name like "PhysicalStorage".
|
||||||
|
pub fn typename(&self) -> &str {
|
||||||
|
match self {
|
||||||
|
Self::PhysicalStorage(_) => "PhysicalStorage",
|
||||||
|
Self::SubDirectory(_) => "SubDirectory",
|
||||||
|
Self::Online(_) => "OnlineStorage",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Short type name with one letter like "P".
|
||||||
|
pub fn shorttypename(&self) -> &str {
|
||||||
|
match self {
|
||||||
|
Self::PhysicalStorage(_) => "P",
|
||||||
|
Self::SubDirectory(_) => "S",
|
||||||
|
Self::Online(_) => "O",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl StorageExt for Storage {
|
impl StorageExt for Storage {
|
||||||
fn name(&self) -> &String {
|
fn name(&self) -> &String {
|
||||||
|
|
Loading…
Reference in a new issue