stash: replace atty with is_terminal from std::io

It's deprecated, oops.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646dc5a20ff1fde23ea9a846a7a3fdd16a
This commit is contained in:
raf 2025-08-20 11:06:45 +03:00
commit ae98cc0b86
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 4 additions and 27 deletions

23
Cargo.lock generated
View file

@ -192,17 +192,6 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.5.0" version = "1.5.0"
@ -712,15 +701,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.5.2" version = "0.5.2"
@ -1058,7 +1038,7 @@ checksum = "b5bd19146350fe804f7cb2669c851c03d69da628803dab0d98018142aaa5d829"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"concurrent-queue", "concurrent-queue",
"hermit-abi 0.5.2", "hermit-abi",
"pin-project-lite", "pin-project-lite",
"rustix 1.0.8", "rustix 1.0.8",
"windows-sys 0.60.2", "windows-sys 0.60.2",
@ -1342,7 +1322,6 @@ dependencies = [
name = "stash" name = "stash"
version = "0.2.4" version = "0.2.4"
dependencies = [ dependencies = [
"atty",
"base64", "base64",
"clap", "clap",
"clap-verbosity-flag", "clap-verbosity-flag",

View file

@ -27,7 +27,6 @@ serde_json = "1.0.143"
base64 = "0.22.1" base64 = "0.22.1"
regex = "1.11.1" regex = "1.11.1"
ratatui = "0.29.0" ratatui = "0.29.0"
atty = "0.2.14"
crossterm = "0.29.0" crossterm = "0.29.0"
unicode-segmentation = "1.12.0" unicode-segmentation = "1.12.0"
unicode-width = "0.2.0" unicode-width = "0.2.0"

View file

@ -1,11 +1,10 @@
use std::{ use std::{
env, env,
io::{self}, io::{self, IsTerminal},
path::PathBuf, path::PathBuf,
process, process,
}; };
use atty::Stream;
use clap::{CommandFactory, Parser, Subcommand}; use clap::{CommandFactory, Parser, Subcommand};
use inquire::Confirm; use inquire::Confirm;
@ -44,7 +43,7 @@ struct Cli {
#[arg(long, default_value_t = 100)] #[arg(long, default_value_t = 100)]
preview_width: u32, preview_width: u32,
/// Path to the SQLite clipboard database file. /// Path to the `SQLite` clipboard database file.
#[arg(long)] #[arg(long)]
db_path: Option<PathBuf>, db_path: Option<PathBuf>,
@ -187,7 +186,7 @@ fn main() {
log::error!("Unsupported format: {other}"); log::error!("Unsupported format: {other}");
}, },
None => { None => {
if atty::is(Stream::Stdout) { if std::io::stdout().is_terminal() {
report_error( report_error(
db.list_tui(cli.preview_width), db.list_tui(cli.preview_width),
"Failed to list entries in TUI", "Failed to list entries in TUI",