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

Method parse_cmd

examples/block3.rs:141–158  ·  view source on GitHub ↗
(&mut self, binary: String)

Source from the content-addressed store, hash-verified

139 }
140
141 fn parse_cmd(&mut self, binary: String) -> Option<Cmd> {
142 let mut args: Vec<String> = vec![];
143 loop {
144 let next = self.tokens.get(self.current);
145 match next {
146 Some(token) if Element::is_operator(token) => {
147 // found operator, so I already parsed all cmd
148 break;
149 }
150 Some(token) => {
151 args.push(token.to_string());
152 }
153 None => break,
154 }
155 self.current += 1;
156 }
157 Some(Cmd { binary, args })
158 }
159}
160
161#[derive(PartialEq, Debug)]

Callers 1

parse_nextMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected