mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
add "copy" that uses copy()
This commit is contained in:
parent
6a014018e7
commit
839cf747a8
1 changed files with 15 additions and 0 deletions
|
|
@ -158,6 +158,21 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"copy" => {
|
"copy" => {
|
||||||
|
if let Some(srcdescriptor) = tokens.next() {
|
||||||
|
if let Some(dstdescriptor) = tokens.next() {
|
||||||
|
write!(ret, "Will copy from {} to {}", srcdescriptor, dstdescriptor).ok();
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"copy2" => {
|
||||||
if let Some(descriptor) = tokens.next() {
|
if let Some(descriptor) = tokens.next() {
|
||||||
if let Some((dict, keyname)) = descriptor.split_once(':') {
|
if let Some((dict, keyname)) = descriptor.split_once(':') {
|
||||||
match self.pddb.get(dict, keyname, None,
|
match self.pddb.get(dict, keyname, None,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue