h3o-cli 0.1.1

A CLI app that exposes most of the h3o API for scripting.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use anyhow::Result as AnyResult;
use either::Either;
use h3o::CellIndex;

/// Get cell indexes, either from a CLI argument or `stdin`.
///
/// First try the CLI arg, and if not set then read from `stdin`.
pub fn get_cell_indexes(
    arg: Option<CellIndex>,
) -> impl Iterator<Item = AnyResult<CellIndex>> {
    arg.map_or_else(
        || Either::Left(crate::io::read_cell_indexes()),
        |index| Either::Right(std::iter::once(Ok(index))),
    )
}