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

Function main

src/user/shell.rs:146–182  ·  view source on GitHub ↗

Main

(args: &[&str])

Source from the content-addressed store, hash-verified

144
145// Main
146pub fn main(args: &[&str]) -> XCode
147{
148 match args.len()
149 {
150 1 =>
151 {
152 run()
153 },
154
155 2 =>
156 {
157 let pname = args[1];
158 if let Ok(contents) = crate::fs::read_to_str(pname)
159 {
160 for ln in contents.split('\n')
161 {
162 if !ln.is_empty()
163 {
164 exec(ln);
165 }
166 }
167
168 XCode::CMD_SUCCESS
169 }
170 else
171 {
172 println!("[ERR] FILE NOT FOUND: '{}'", pname);
173 XCode::CMD_ERR
174 }
175 },
176
177 _ =>
178 {
179 XCode::CMD_ERR
180 },
181 }
182}
183
184// Prompt string function
185pub fn promptstr(success: bool) -> String

Callers

nothing calls this directly

Calls 4

runFunction · 0.85
read_to_strFunction · 0.85
execFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected