MCPcopy Create free account
hub / github.com/corrode/write-yourself-a-shell / parse_cmd

Method parse_cmd

examples/block2.rs:64–81  ·  view source on GitHub ↗
(&mut self, binary: String)

Source from the content-addressed store, hash-verified

62 }
63
64 fn parse_cmd(&mut self, binary: String) -> Option<Cmd> {
65 let mut args: Vec<String> = vec![];
66 loop {
67 let next = self.tokens.get(self.current);
68 match next {
69 Some(token) if Element::is_operator(token) => {
70 // found operator, so I already parsed all cmd
71 break;
72 }
73 Some(token) => {
74 args.push(token.to_string());
75 }
76 None => break,
77 }
78 self.current += 1;
79 }
80 Some(Cmd { binary, args })
81 }
82}
83
84#[derive(PartialEq, Debug)]

Callers 1

parse_nextMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected