Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions coman/src/cli/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,13 @@ fn remote_path_completer(current: &std::ffi::OsStr) -> Vec<CompletionCandidate>
let roots = cscs_file_list(current.clone(), None, None).await;
if let Ok(roots) = roots {
for root in roots {
if root.path_type == PathType::File {
send.send(CompletionCandidate::new(current.join(root.name.clone())))
.unwrap();
} else {
if root.path_type == PathType::Directory {
// joining with "" ensures trailing slash
send.send(CompletionCandidate::new(current.join(root.name.clone()).join("")))
.unwrap();
} else {
send.send(CompletionCandidate::new(current.join(root.name.clone())))
.unwrap();
}
}
} else {
Expand All @@ -430,12 +430,12 @@ fn remote_path_completer(current: &std::ffi::OsStr) -> Vec<CompletionCandidate>
let partial = current.file_name().unwrap().to_string_lossy().into_owned();
for root in roots {
if root.name.starts_with(&partial) {
if root.path_type == PathType::File {
send.send(CompletionCandidate::new(parent.join(root.name))).unwrap();
} else {
if root.path_type == PathType::Directory {
// joining with "" ensures trailing slash
send.send(CompletionCandidate::new(parent.join(root.name.clone()).join("")))
.unwrap();
} else {
send.send(CompletionCandidate::new(parent.join(root.name))).unwrap();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions coman/src/components/file_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl Component<Msg, UserEvent> for FileTree {
}
}
PathType::File => CmdResult::None,
PathType::Link => CmdResult::None,
}
}
Event::Keyboard(KeyEvent {
Expand Down
2 changes: 2 additions & 0 deletions coman/src/cscs/api_client/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl From<CSCSFileSystem> for FileSystem {
pub enum PathType {
Directory,
File,
Link,
}

#[derive(Debug, Eq, Clone, PartialEq, PartialOrd, Ord, tabled::Tabled)]
Expand Down Expand Up @@ -113,6 +114,7 @@ impl From<CSCSFile> for PathEntry {
path_type: match value.r#type.as_str() {
"d" => PathType::Directory,
"-" => PathType::File,
"l" => PathType::Link,
_ => panic!("Unknown file type: {}", value.r#type),
},
permissions: Some(value.permissions),
Expand Down