Go to parent directory with <BACKSPACE>
@@ -381,11 +381,9 @@ impl FileTransferActivity {
KeyCode::Enter => {
// Match selected file
if let Some(entry) = self.local.files.get(self.local.index) {
- match entry {
- FsEntry::Directory(dir) => {
+ if let FsEntry::Directory(dir) = entry {
// Change directory
- if let Err(err) =
- context.local.change_wrkdir(dir.abs_path.clone())
+ if let Err(err) = context.local.change_wrkdir(dir.abs_path.clone())
{
// Report err
self.input_mode = InputMode::Popup(PopupType::Alert(
@@ -396,10 +394,22 @@ impl FileTransferActivity {
// Update files
self.local.files = context.local.list_dir();
}
- FsEntry::File(file) => {
- // TODO: upload file
}
}
+ KeyCode::Backspace => {
+ // Go previous directory
+ let wrkdir: PathBuf = context.local.pwd();
+ if let Some(parent) = wrkdir.as_path().parent() {
+ // Change directory
+ if let Err(err) = context.local.change_wrkdir(PathBuf::from(parent)) {
+ // Report err
+ self.input_mode = InputMode::Popup(PopupType::Alert(
+ Color::Red,
+ format!("Could not change working directory: {}", err),
+ ));
+ }
+ // Update files
+ self.local.files = context.local.list_dir();
}
}
KeyCode::Delete => {
@@ -433,6 +443,9 @@ impl FileTransferActivity {
// TODO:
}
}
+ ' ' => {
+ // TODO: Upload file
+ }
_ => { /* Nothing to do */ }
},
_ => { /* Nothing to do */ }
