-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add shell aliases * Fix env output error * Fix sort * Read aliases from config file * Simplify arguments parsing * Fix test * Clone params to spawn syscall * Run clippy * Revert "Clone params to spawn syscall" This reverts commit 4c91bea. * Disable binary stripping * Remove exit alias * Update doc
- Loading branch information
Showing
18 changed files
with
248 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Command shortcuts | ||
alias p print | ||
alias c copy | ||
alias d delete | ||
alias del delete | ||
alias e edit | ||
alias f find | ||
alias g goto | ||
alias go goto | ||
alias h help | ||
alias l list | ||
alias m move | ||
alias q quit | ||
alias r read | ||
alias w write | ||
alias sh shell | ||
alias dsk disk | ||
alias mem memory | ||
alias kbd keyboard | ||
|
||
# Unix compatibility | ||
# alias cd goto | ||
# alias cp copy | ||
# alias echo print | ||
# alias exit quit | ||
# alias ls list | ||
# alias mv move | ||
# alias rm delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
use crate::{sys, usr}; | ||
|
||
pub fn main(args: &[&str]) -> usr::shell::ExitCode { | ||
if args.len() == 1 { | ||
for (key, val) in sys::process::envs() { | ||
println!("{}={}", key, val); | ||
match args.len() { | ||
1 => { | ||
for (key, val) in sys::process::envs() { | ||
println!("{:10} \"{}\"", key, val); | ||
} | ||
usr::shell::ExitCode::CommandSuccessful | ||
} | ||
} else { | ||
for arg in args[1..].iter() { | ||
if let Some(i) = arg.find('=') { | ||
let (key, mut val) = arg.split_at(i); | ||
val = &val[1..]; | ||
sys::process::set_env(key, val); | ||
println!("{}={}", key, val); | ||
2 => { | ||
let key = args[1]; | ||
if let Some(val) = sys::process::env(key) { | ||
println!("{}", val); | ||
usr::shell::ExitCode::CommandSuccessful | ||
} else { | ||
error!("Error: could not parse '{}'", arg); | ||
return usr::shell::ExitCode::CommandError; | ||
error!("Could not get '{}'", key); | ||
usr::shell::ExitCode::CommandError | ||
} | ||
} | ||
3 => { | ||
sys::process::set_env(args[1], args[2]); | ||
usr::shell::ExitCode::CommandSuccessful | ||
} | ||
_ => { | ||
error!("Invalid number of arguments"); | ||
usr::shell::ExitCode::CommandError | ||
} | ||
} | ||
usr::shell::ExitCode::CommandSuccessful | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.