diff --git a/Cargo.toml b/Cargo.toml index 9cd9ade..b3546ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ sha2 = "0.10" sled = "0.34" bincode = "2" arboard = "3" +base64 = "0.22" [workspace.package] description = "An interactive, Rust-powered shell history search tool inspired by hstr" diff --git a/README.md b/README.md index 07afdc6..425a551 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ cargo test ## 🛠 Update the version ```zsh -cargo release 1.4.0 --no-push --no-tag --no-publish --execute -cargo patch --no-push --no-tag --no-publish --execute -cargo minor --no-push --no-tag --no-publish --execute +cargo release major --no-push --no-tag --no-publish --execute +cargo relase patch --no-push --no-tag --no-publish --execute +cargo release minor --no-push --no-tag --no-publish --execute ``` diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..e69de29 diff --git a/rushstr-core/Cargo.toml b/rushstr-core/Cargo.toml index 6bbd7cc..b575442 100644 --- a/rushstr-core/Cargo.toml +++ b/rushstr-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rushstr-core" -version = "1.4.1" +version = "1.4.2" edition = "2024" description = "An interactive, Rust-powered shell history search tool inspired by hstr" license = "MIT" diff --git a/rushstr-tui/Cargo.toml b/rushstr-tui/Cargo.toml index 5ac887a..192c943 100644 --- a/rushstr-tui/Cargo.toml +++ b/rushstr-tui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rushstr-tui" -version = "1.4.1" +version = "1.4.2" edition = "2024" description = "An interactive, Rust-powered shell history search tool inspired by hstr" license = "MIT" @@ -13,4 +13,5 @@ crossterm.workspace = true ratatui.workspace = true anyhow.workspace = true arboard.workspace = true -rushstr-core = { path = "../rushstr-core", version = "1.4.1" } +base64.workspace = true +rushstr-core = { path = "../rushstr-core", version = "1.4.2" } diff --git a/rushstr-tui/src/ux/search_ui.rs b/rushstr-tui/src/ux/search_ui.rs index b52db2a..cad9e97 100644 --- a/rushstr-tui/src/ux/search_ui.rs +++ b/rushstr-tui/src/ux/search_ui.rs @@ -61,7 +61,7 @@ impl SearchUI { }, KeyCode::Char('c') if key.modifiers == KeyModifiers::CONTROL => { if let Some(cmd) = items.get(ui_state.selected) { - Clipboard::new()?.set_text(cmd.raw_text())?; + copy_to_clipboard(cmd); } return Ok(None); }, @@ -97,6 +97,21 @@ impl SearchUI { } } +/// Copies the raw text of a command to the system clipboard. +/// +/// This function first attempts to use the system clipboard via the `arboard` +/// crate. +/// +/// # Parameters +/// - `cmd`: A reference to the `HItem` whose raw text will be copied. +#[allow(clippy::collapsible_if)] +fn copy_to_clipboard(cmd: &HItem) { + // Try using system clipboard via arboard + if let Ok(mut clipboard) = Clipboard::new() { + let _ = clipboard.set_text(cmd.raw_text()); + } +} + /// Returns the raw text of the currently selected item in the list, if any. /// Also marks the item as "hit" in the store. /// @@ -127,7 +142,7 @@ fn get_selected(items: &[HItem], ui_state: &UiState, store: &Store) -> anyhow::R /// * `ui_state` - Mutable reference to the UI state. /// * `char` - The character to append to the input. fn put_char(ui_state: &mut UiState, char: char) { - if ui_state.search_options.input.len() < 50 { + if ui_state.search_options.input.len() < 150 { ui_state.search_options.input.push(char); ui_state.selected = 0; ui_state.offset = 0; diff --git a/rushstr/Cargo.toml b/rushstr/Cargo.toml index 17d0997..23f67c9 100644 --- a/rushstr/Cargo.toml +++ b/rushstr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rushstr" -version = "1.4.1" +version = "1.4.2" edition = "2024" description = "An interactive, Rust-powered shell history search tool inspired by hstr" license = "MIT" @@ -11,8 +11,8 @@ homepage = "https://github.com/donhk/rushstr" [dependencies] anyhow.workspace = true clap.workspace = true -rushstr-core = { path = "../rushstr-core", version = "1.4.1" } -rushstr-tui = { path = "../rushstr-tui", version = "1.4.1" } +rushstr-core = { path = "../rushstr-core", version = "1.4.2" } +rushstr-tui = { path = "../rushstr-tui", version = "1.4.2" } [[bin]] name = "rushstr"