Compare commits
No commits in common. "701643848aa142c0f7d35e62816a52bfb2df6168" and "142d7211bc786502b4d1c5491aef8f46c1ca1e69" have entirely different histories.
701643848a
...
142d7211bc
2 changed files with 3 additions and 10 deletions
|
@ -24,14 +24,9 @@ impl Builtin {
|
||||||
let mut args = argv.clone();
|
let mut args = argv.clone();
|
||||||
let program = args.remove(0);
|
let program = args.remove(0);
|
||||||
|
|
||||||
let function = match program.as_str() {
|
if program == "cd" {
|
||||||
"cd" => Some(builtins::cd),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
if function.is_some() {
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
function: function.unwrap(),
|
function: builtins::cd,
|
||||||
args,
|
args,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
use std::env;
|
|
||||||
use std::fmt::{Display, Formatter, Result};
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn print_error(message: &str) {
|
pub fn print_error(message: &str) {
|
||||||
let name = env::args().next().unwrap_or(String::from("rash"));
|
let name = std::env::args().next().unwrap();
|
||||||
let name = Path::new(&name).file_name().unwrap().to_str().unwrap();
|
let name = Path::new(&name).file_name().unwrap().to_str().unwrap();
|
||||||
|
|
||||||
eprintln!("{}: {}", name, message);
|
eprintln!("{}: {}", name, message);
|
||||||
|
|
Loading…
Reference in a new issue