aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/command/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/turtle/src/command/mod.rs (renamed from crates/atuin/src/command/mod.rs)26
1 files changed, 10 insertions, 16 deletions
diff --git a/crates/atuin/src/command/mod.rs b/crates/turtle/src/command/mod.rs
index 8aac4062..e58bfe72 100644
--- a/crates/atuin/src/command/mod.rs
+++ b/crates/turtle/src/command/mod.rs
@@ -24,7 +24,7 @@ pub enum AtuinCmd {
/// PTY proxy for atuin
#[cfg(feature = "pty-proxy")]
#[command(alias = "hex")]
- PtyProxy(atuin_pty_proxy::PtyProxy),
+ PtyProxy(crate::atuin_pty_proxy::PtyProxy),
/// Generate a UUID
Uuid,
@@ -63,7 +63,7 @@ impl AtuinCmd {
Ok(())
}
Self::Uuid => {
- println!("{}", atuin_common::utils::uuid_v7().as_simple());
+ println!("{}", crate::atuin_common::utils::uuid_v7().as_simple());
Ok(())
}
Self::GenCompletions(gen_completions) => gen_completions.run(),
@@ -73,7 +73,7 @@ impl AtuinCmd {
}
#[cfg(all(feature = "pty-proxy", unix))]
-fn run_pty_proxy(proxy: atuin_pty_proxy::PtyProxy) {
+fn run_pty_proxy(proxy: crate::atuin_pty_proxy::PtyProxy) {
#[cfg(feature = "daemon")]
proxy.run(semantic_command_capture_sink());
@@ -81,14 +81,8 @@ fn run_pty_proxy(proxy: atuin_pty_proxy::PtyProxy) {
proxy.run(None);
}
-#[cfg(all(feature = "pty-proxy", not(unix)))]
-fn run_pty_proxy(_proxy: atuin_pty_proxy::PtyProxy) {
- eprintln!("atuin pty-proxy currently supports unix platforms");
- std::process::exit(1);
-}
-
#[cfg(all(feature = "daemon", feature = "pty-proxy", unix))]
-fn semantic_command_capture_sink() -> Option<atuin_pty_proxy::CommandCaptureSink> {
+fn semantic_command_capture_sink() -> Option<crate::atuin_pty_proxy::CommandCaptureSink> {
use std::sync::mpsc;
use std::time::Duration;
@@ -96,8 +90,8 @@ fn semantic_command_capture_sink() -> Option<atuin_pty_proxy::CommandCaptureSink
return None;
}
- let settings = atuin_client::settings::Settings::new().ok()?;
- let (tx, rx) = mpsc::sync_channel::<atuin_pty_proxy::CommandCapture>(128);
+ let settings = crate::atuin_client::settings::Settings::new().ok()?;
+ let (tx, rx) = mpsc::sync_channel::<crate::atuin_pty_proxy::CommandCapture>(128);
std::thread::spawn(move || {
let Ok(runtime) = tokio::runtime::Builder::new_current_thread()
@@ -139,12 +133,12 @@ fn is_truthy_env(name: &str) -> bool {
#[cfg(all(feature = "daemon", feature = "pty-proxy", unix))]
async fn send_semantic_command_captures(
- settings: &atuin_client::settings::Settings,
- batch: Vec<atuin_pty_proxy::CommandCapture>,
+ settings: &crate::atuin_client::settings::Settings,
+ batch: Vec<crate::atuin_pty_proxy::CommandCapture>,
) {
let captures = batch
.into_iter()
- .map(|capture| atuin_daemon::semantic::CommandCapture {
+ .map(|capture| crate::atuin_daemon::semantic::CommandCapture {
prompt: capture.prompt,
command: capture.command,
output: capture.output,
@@ -156,7 +150,7 @@ async fn send_semantic_command_captures(
})
.collect();
- if let Ok(mut client) = atuin_daemon::SemanticClient::from_settings(settings).await {
+ if let Ok(mut client) = crate::atuin_daemon::SemanticClient::from_settings(settings).await {
let _ = client.record_commands(captures).await;
}
}