MCPcopy Create free account
hub / github.com/arraypad/each / main

Function main

src/main.rs:19–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17use readers::{CachedReader, FileReader};
18
19fn main() {
20 env_logger::init();
21
22 let formats = formats::load_formats();
23 let format_ids: Vec<&str> = formats.iter().map(|(&k, _)| k).collect();
24
25 let mut args = Command::new("each")
26 .version("0.2")
27 .author("Arpad Ray <hello@arpad.pizza>")
28 .about("Build and execute command lines from structured input")
29 .trailing_var_arg(true)
30 .arg(
31 Arg::new("input")
32 .short('i')
33 .long("input")
34 .value_name("FILE")
35 .multiple_occurrences(true)
36 .help("Read input from FILE instead of stdin")
37 .takes_value(true),
38 )
39 .arg(
40 Arg::new("format")
41 .short('f')
42 .long("format")
43 .value_name("FORMAT")
44 .help("Input file format")
45 .takes_value(true)
46 .possible_values(format_ids.as_slice()),
47 )
48 .arg(
49 Arg::new("query")
50 .short('q')
51 .long("query")
52 .value_name("QUERY")
53 .help("JMES query to apply to each input file")
54 .takes_value(true),
55 )
56 .arg(
57 Arg::new("output-format")
58 .short('F')
59 .long("output-format")
60 .value_name("FORMAT")
61 .help("Output file format")
62 .takes_value(true)
63 .possible_values(format_ids.as_slice()),
64 )
65 .arg(
66 Arg::new("prompt")
67 .short('p')
68 .long("interactive")
69 .help("Prompt for each value"),
70 )
71 .arg(
72 Arg::new("max-procs")
73 .short('P')
74 .long("max-procs")
75 .value_name("max-procs")
76 .help("Run up to max-procs processes at a time")

Callers

nothing calls this directly

Calls 3

load_formatsFunction · 0.85
runFunction · 0.85
add_argumentsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…