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

Method parse_cmd

examples/block4.rs:178–195  ·  view source on GitHub ↗
(&mut self, binary: String)

Source from the content-addressed store, hash-verified

176 }
177
178 fn parse_cmd(&mut self, binary: String) -> Option<Cmd> {
179 let mut args: Vec<String> = vec![];
180 loop {
181 let next = self.tokens.get(self.current);
182 match next {
183 Some(token) if Element::is_operator(token) => {
184 // found operator, so I already parsed all cmd
185 break;
186 }
187 Some(token) => {
188 args.push(token.to_string());
189 }
190 None => break,
191 }
192 self.current += 1;
193 }
194 Some(Cmd { binary, args })
195 }
196}
197
198#[derive(PartialEq, Debug)]

Callers 1

parse_nextMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected