Default to streaming, not collection

This commit is contained in:
Tony Garnock-Jones 2021-08-10 08:43:33 -04:00
parent e02ee00894
commit 0821f6e3da
1 changed files with 7 additions and 7 deletions

View File

@ -104,7 +104,7 @@ struct Convert {
select_output: SelectOutput, select_output: SelectOutput,
#[clap(long)] #[clap(long)]
stream: bool, collect: bool,
#[clap(long, arg_enum, value_name = "on/off", default_value = "on")] #[clap(long, arg_enum, value_name = "on/off", default_value = "on")]
annotations: Boolish, annotations: Boolish,
@ -374,16 +374,16 @@ fn convert(c: Convert) -> io::Result<()> {
while let Some(value) = vs.next() { while let Some(value) = vs.next() {
let value = value?; let value = value?;
let matches = c.select.exec(&value); let matches = c.select.exec(&value);
if c.stream { if c.collect {
match c.select_output {
SelectOutput::Sequence => for v in matches { w(&v)?; },
SelectOutput::Set => for v in Set::from_iter(matches) { w(&v)?; },
}
} else {
match c.select_output { match c.select_output {
SelectOutput::Sequence => w(&IOValue::new(matches))?, SelectOutput::Sequence => w(&IOValue::new(matches))?,
SelectOutput::Set => w(&IOValue::new(Set::from_iter(matches)))?, SelectOutput::Set => w(&IOValue::new(Set::from_iter(matches)))?,
} }
} else {
match c.select_output {
SelectOutput::Sequence => for v in matches { w(&v)?; },
SelectOutput::Set => for v in Set::from_iter(matches) { w(&v)?; },
}
} }
if let Some(limit) = c.limit { if let Some(limit) = c.limit {
if vs.count >= limit { if vs.count >= limit {