Skip to content

Commit

Permalink
Merge branch 'main' into touch
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami authored Sep 28, 2024
2 parents 07609d3 + 1113c78 commit 1e35479
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
35 changes: 32 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ chrono = "0.4.38"
parse_datetime = "0.6.0"
dtparse = "2.0.1"
windows-sys = "0.59.0"
ctrlc = "3.4.5"

[package.metadata.release]
# Dont publish the binary
Expand Down
3 changes: 3 additions & 0 deletions crates/shell/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ fn complete_filenames(_is_start: bool, word: &str, matches: &mut Vec<Pair>) {
// Determine the full directory path to search
let search_dir = if dir_path.starts_with('/') {
dir_path.to_string()
} else if let Some(stripped) = dir_path.strip_prefix('~') {
let home_dir = dirs::home_dir().unwrap();
format!("{}{}", home_dir.display(), stripped)
} else {
format!("./{}", dir_path)
};
Expand Down
7 changes: 6 additions & 1 deletion crates/shell/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ fn init_state() -> ShellState {
async fn interactive() -> anyhow::Result<()> {
let config = Config::builder()
.history_ignore_space(true)
.completion_type(CompletionType::Circular)
.completion_type(CompletionType::List)
.build();

ctrlc::set_handler(move || {
println!("Received Ctrl+C");
})
.expect("Error setting Ctrl-C handler");

let mut rl = Editor::with_config(config)?;

let helper = helper::ShellPromptHelper::default();
Expand Down

0 comments on commit 1e35479

Please sign in to comment.