MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / run

Function run

src/user/shell.rs:205–245  ·  view source on GitHub ↗

Run

()

Source from the content-addressed store, hash-verified

203
204// Run
205pub fn run() -> crate::user::shell::XCode
206{
207 println!();
208
209 let mut prompt = crate::sys::prompt::Prompt::new();
210 let histfile = "~/.sh-hist";
211 prompt.hist.load(histfile);
212 prompt.compl.set(&shcomp);
213
214 let mut success = true;
215 while let Some(cmd) = prompt.input(&promptstr(success))
216 {
217 match exec(&cmd)
218 {
219 XCode::CMD_SUCCESS =>
220 {
221 success = true;
222 },
223
224 XCode::SHEX =>
225 {
226 break;
227 },
228
229 _ =>
230
231 {
232 success = false;
233 },
234 }
235
236 prompt.hist.add(&cmd);
237 prompt.hist.save(histfile);
238 crate::sys::console::drain();
239 println!();
240 }
241
242 // Clears screen, move cursor to top of display
243 print!("\x1b[2J\x1b[1;1H");
244 XCode::CMD_SUCCESS
245}
246
247
248// Shell completion

Callers 1

mainFunction · 0.85

Calls 8

promptstrFunction · 0.85
execFunction · 0.85
drainFunction · 0.85
loadMethod · 0.80
inputMethod · 0.80
saveMethod · 0.80
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected