aboutsummaryrefslogtreecommitdiff
path: root/src/prompt/builtins.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/prompt/builtins.rs')
-rw-r--r--src/prompt/builtins.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/prompt/builtins.rs b/src/prompt/builtins.rs
index 18a5f8e..d58005a 100644
--- a/src/prompt/builtins.rs
+++ b/src/prompt/builtins.rs
@@ -3,6 +3,8 @@
use std::{io::Write, str::FromStr};
+use sysinfo::SystemExt;
+
use crate::config::Config;
const FILES: [&str; 2] = ["README.rst", "Whirl.toml"];
@@ -16,6 +18,7 @@ pub enum BuiltIn {
Ls,
Cat,
Config,
+ Fetch,
}
impl FromStr for BuiltIn {
type Err = ();
@@ -30,6 +33,7 @@ impl FromStr for BuiltIn {
"ls" => Ok(BuiltIn::Ls),
"cat" => Ok(BuiltIn::Cat),
"config" => Ok(BuiltIn::Config),
+ "fetch" => Ok(BuiltIn::Fetch),
_ => Err(()),
}
}
@@ -55,6 +59,7 @@ pub fn builtin_help() -> i32 {
println!("cat - display the contents of a present file");
println!("config - manipulate the configuration");
println!("help - you are here");
+ println!("fetch - a neofetch like utility loosely based on rfetch");
0
}
@@ -119,3 +124,19 @@ pub fn builtin_config(args: &[String]) -> i32 {
}
0
}
+
+pub fn builtin_fetch() -> i32 {
+ // rfetch: https://github.com/Mangeshrex/rfetch
+
+ let mut sys = sysinfo::System::new();
+ sys.refresh_processes();
+
+ println!(" ");
+ println!(" .-. os {}", env!("CARGO_PKG_NAME"));
+ println!(" oo| ker {}", env!("CARGO_PKG_VERSION"));
+ println!(" / '\\ sh /wsh");
+ println!(" (\\_;/) up null");
+ println!(" ");
+
+ 0
+}