mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +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" => {
|
||||
if let Some(srcdescriptor) = tokens.next() {
|
||||
if let Some(dstdescriptor) = tokens.next() {
|
||||
match std::fs::copy(srcdescriptor, dstdescriptor) {
|
||||
Ok(_result) => {
|
||||
write!(ret, "Copy from {} to {} succeeded", srcdescriptor, dstdescriptor).ok();
|
||||
}
|
||||
Err(e) => {
|
||||
write!(ret, "Error copying from {} to {}: {:?}", srcdescriptor, dstdescriptor, e).ok();
|
||||
if let Some((_srcdict, _srckeyname)) = srcdescriptor.split_once(':') {
|
||||
if let Some((_dstdict, _dstkeyname)) = dstdescriptor.split_once(':') {
|
||||
match std::fs::copy(srcdescriptor, dstdescriptor) {
|
||||
Ok(_result) => {
|
||||
write!(ret, "Copy from {} to {} succeeded", srcdescriptor, dstdescriptor).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" => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue