mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add helpful error messages in keeping with style
This commit is contained in:
parent
d8a8046521
commit
8804f7ef17
1 changed files with 18 additions and 6 deletions
|
|
@ -160,15 +160,27 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
||||||
"copy" => {
|
"copy" => {
|
||||||
if let Some(srcdescriptor) = tokens.next() {
|
if let Some(srcdescriptor) = tokens.next() {
|
||||||
if let Some(dstdescriptor) = tokens.next() {
|
if let Some(dstdescriptor) = tokens.next() {
|
||||||
match std::fs::copy(srcdescriptor, dstdescriptor) {
|
if let Some((_srcdict, _srckeyname)) = srcdescriptor.split_once(':') {
|
||||||
Ok(_result) => {
|
if let Some((_dstdict, _dstkeyname)) = dstdescriptor.split_once(':') {
|
||||||
write!(ret, "Copy from {} to {} succeeded", srcdescriptor, dstdescriptor).ok();
|
match std::fs::copy(srcdescriptor, dstdescriptor) {
|
||||||
}
|
Ok(_result) => {
|
||||||
Err(e) => {
|
write!(ret, "Copy from {} to {} succeeded", srcdescriptor, dstdescriptor).ok();
|
||||||
write!(ret, "Error copying from {} to {}: {:?}", srcdescriptor, dstdescriptor, e).ok();
|
}
|
||||||
|
Err(e) => {
|
||||||
|
write!(ret, "Error copying from {} to {}: {:?}", srcdescriptor, dstdescriptor, e).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
write!(ret, "Destination {} is not of required form 'dict:key'", dstdescriptor).unwrap();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
write!(ret, "Source {} is not of required form 'dict:key'", srcdescriptor).unwrap();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
write!(ret, "Usage is copy 'dict:key' 'dict:key' (missing destination)").unwrap();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
write!(ret, "Usage is copy 'dict:key' 'dict:key' (missing source)").unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"write" => {
|
"write" => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue