Browse Source
Merge branch 'main' of https://gitlab2.informatik.hs-fulda.de/fdai7381/pmuw-project
main
Merge branch 'main' of https://gitlab2.informatik.hs-fulda.de/fdai7381/pmuw-project
main
fdai7375
2 years ago
10 changed files with 129 additions and 14 deletions
-
0._gitlab-ci.yml
-
12Cargo.lock
-
1Cargo.toml
-
13src/builtins/fetch.rs
-
25src/builtins/help.rs
-
9src/builtins/ls.rs
-
20src/builtins/mod.rs
-
11src/builtins/segfault.rs
-
31src/builtins/sus.rs
-
21src/main.rs
@ -0,0 +1,25 @@ |
|||
use crate::builtins::{Builtin, BuiltinConfig};
|
|||
use crate::error::ShellError;
|
|||
|
|||
pub struct Help;
|
|||
|
|||
impl Builtin for Help {
|
|||
fn execute(&mut self, _: &mut BuiltinConfig, _: Vec<String>) -> Result<(), ShellError> {
|
|||
let commands =
|
|||
"cd changes current working directory
|
|||
change-prompt changes prompt style (default, bashlike, simpledirectory)
|
|||
exit exits the shell
|
|||
fetch prints out system information
|
|||
help displays this command
|
|||
ls lists contents of directory
|
|||
open shows content of files
|
|||
pwd shows path to current working directory
|
|||
segfault exit but through segfault
|
|||
sus shows amogus";
|
|||
|
|||
for line in commands.lines() {
|
|||
println!("{}", line.trim_start());
|
|||
}
|
|||
Ok(())
|
|||
}
|
|||
}
|
@ -0,0 +1,11 @@ |
|||
use crate::builtins::{Builtin, BuiltinConfig};
|
|||
use crate::error::ShellError;
|
|||
|
|||
pub struct Segfault;
|
|||
|
|||
impl Builtin for Segfault {
|
|||
fn execute(&mut self, _: &mut BuiltinConfig, _: Vec<String>) -> Result<(), ShellError> {
|
|||
unsafe { std::ptr::null_mut::<i32>().write(69) };
|
|||
Ok(())
|
|||
}
|
|||
}
|
@ -0,0 +1,31 @@ |
|||
use crate::builtins::{Builtin, BuiltinConfig};
|
|||
use crate::error::ShellError;
|
|||
|
|||
pub struct Sus;
|
|||
|
|||
impl Builtin for Sus {
|
|||
fn execute(&mut self, _: &mut BuiltinConfig, _: Vec<String>) -> Result<(), ShellError> {
|
|||
println!(
|
|||
"
|
|||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣤⣤⣤⣤⣶⣦⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⠛⠉⠙⠛⠛⠛⠛⠻⢿⣿⣷⣤⡀⠀⠀⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠈⢻⣿⣿⡄⠀⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⣸⣿⡏⠀⠀⠀⣠⣶⣾⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣄⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⢰⣿⣿⣯⠁⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣷⡄⠀
|
|||
⠀⠀⣀⣤⣴⣶⣶⣿⡟⠀⠀⠀⢸⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣷⠀
|
|||
⠀⢰⣿⡟⠋⠉⣹⣿⡇⠀⠀⠀⠘⣿⣿⣿⣿⣷⣦⣤⣤⣤⣶⣶⣶⣶⣿⣿⣿⠀
|
|||
⠀⢸⣿⡇⠀⠀⣿⣿⡇⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀
|
|||
⠀⣸⣿⡇⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠉⠻⠿⣿⣿⣿⣿⡿⠿⠿⠛⢻⣿⡇⠀⠀
|
|||
⠀⣿⣿⠁⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣧⠀⠀
|
|||
⠀⢿⣿⡆⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀
|
|||
⠀⠸⣿⣧⡀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠃⠀⠀
|
|||
⠀⠀⠛⢿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⣰⣿⣿⣷⣶⣶⣶⣶⠶⠀⢠⣿⣿⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⣽⣿⡏⠁⠀⠀⢸⣿⡇⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⣿⣿⡇⠀⢹⣿⡆⠀⠀⠀⣸⣿⠇⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⢿⣿⣦⣄⣀⣠⣴⣿⣿⠁⠀⠈⠻⣿⣿⣿⣿⡿⠏⠀⠀⠀⠀
|
|||
⠀⠀⠀⠀⠀⠀⠀⠈⠛⠻⠿⠿⠿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|||
"
|
|||
);
|
|||
Ok(())
|
|||
}
|
|||
}
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue