A fork of attic a self-hostable Nix Binary Cache server
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

attic-client/push: Add flag to read paths from stdin

authored by

jzbor and committed by
Zhaofeng Li
265038a1 416687e5

+20 -6
+20 -6
client/src/command/push.rs
··· 1 + use std::io; 2 + use std::io::BufRead; 1 3 use std::path::PathBuf; 2 4 use std::sync::Arc; 3 5 ··· 24 26 /// The store paths to push. 25 27 paths: Vec<PathBuf>, 26 28 29 + /// Read paths from stdin 30 + #[clap(short = 'i', long)] 31 + stdin: bool, 32 + 27 33 /// Push the specified paths only and do not compute closures. 28 34 #[clap(long)] 29 35 no_closure: bool, ··· 50 56 let config = Config::load()?; 51 57 52 58 let store = Arc::new(NixStore::connect()?); 53 - let roots = sub 54 - .paths 55 - .clone() 56 - .into_iter() 57 - .map(|p| store.follow_store_path(p)) 58 - .collect::<std::result::Result<Vec<_>, _>>()?; 59 + let roots = if sub.stdin { 60 + io::stdin() 61 + .lock() 62 + .lines() 63 + .flatten() 64 + .map(|p| store.follow_store_path(p.trim())) 65 + .collect::<std::result::Result<Vec<_>, _>>()? 66 + } else { 67 + sub.paths 68 + .clone() 69 + .into_iter() 70 + .map(|p| store.follow_store_path(p)) 71 + .collect::<std::result::Result<Vec<_>, _>>()? 72 + }; 59 73 60 74 let (server_name, server, cache) = config.resolve_cache(&sub.cache)?; 61 75