1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

client/push: Suggest --stdin if stdin isn't a terminal

This commit is contained in:
Zhaofeng Li 2024-10-06 12:29:03 -06:00
parent 8f215042db
commit 014fb92a9e

View file

@ -1,3 +1,4 @@
use std::io::IsTerminal;
use std::path::PathBuf;
use std::sync::Arc;
@ -57,6 +58,16 @@ struct PushContext {
impl PushContext {
async fn push_static(self, paths: Vec<PathBuf>) -> Result<()> {
if paths.is_empty() {
eprintln!("🤷 Nothing specified.");
if !std::io::stdin().is_terminal() {
eprintln!(
"Hint: Pass --stdin to read the list of store paths from standard input."
);
}
return Ok(());
}
let roots = paths
.into_iter()
.map(|p| self.store.follow_store_path(p))