From a9a42e3fa012ebf9dc0b56a6cc97a10eb8999dcd Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 19 Mar 2026 17:48:04 -0700 Subject: feat: error if value not provided and no stdin --- crates/atuin/src/command/client/kv.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/atuin/src/command/client/kv.rs b/crates/atuin/src/command/client/kv.rs index 2736c7a6..88e3edeb 100644 --- a/crates/atuin/src/command/client/kv.rs +++ b/crates/atuin/src/command/client/kv.rs @@ -1,4 +1,4 @@ -use std::io::{self, Read}; +use std::io::{self, IsTerminal, Read}; use clap::Subcommand; use eyre::{Context, Result, eyre}; @@ -84,12 +84,16 @@ impl Cmd { let value = if let Some(v) = value { v.clone() - } else { + } else if !io::stdin().is_terminal() { let mut buf = String::new(); io::stdin() .read_to_string(&mut buf) .context("failed to read value from stdin")?; buf + } else { + return Err(eyre!( + "no value provided. Pass as an argument or pipe via stdin" + )); }; kv_store.set(namespace, key, &value).await -- cgit v1.3.1