diff options
| author | Fuwn <[email protected]> | 2021-05-05 16:06:31 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-05 16:06:31 +0000 |
| commit | 581a04985cfbfc709bb6b3800e0c41bf47c7343e (patch) | |
| tree | 41407f9af6fe667347991ea572ad47b1d18820e2 /src | |
| parent | fix(config): add ip field to example config (diff) | |
| download | whirl-581a04985cfbfc709bb6b3800e0c41bf47c7343e.tar.xz whirl-581a04985cfbfc709bb6b3800e0c41bf47c7343e.zip | |
feat(prompt): ability to specify prompt ps1
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/Whirl.default.toml | 1 | ||||
| -rw-r--r-- | src/config/mod.rs | 1 | ||||
| -rw-r--r-- | src/prompt/mod.rs | 11 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/config/Whirl.default.toml b/src/config/Whirl.default.toml index eb0758f..591a77e 100644 --- a/src/config/Whirl.default.toml +++ b/src/config/Whirl.default.toml @@ -2,6 +2,7 @@ worldsmaster_username = "WORLDSMASTER" # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING log_level = 1 # Generally, you should only change this if you are expiriencing issues ip = "0.0.0.0" # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING +prompt_ps1 = "[WORLDSMASTER@Whirlsplash ~]$" [distributor] worldsmaster_greeting = "Welcome to Whirlsplash!" diff --git a/src/config/mod.rs b/src/config/mod.rs index b1fa789..3815b3d 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -8,6 +8,7 @@ pub struct WhirlsplashConfig { pub worldsmaster_username: String, pub log_level: i64, pub ip: String, + pub prompt_ps1: String, } #[derive(Serialize, Deserialize, Debug)] pub struct DistributorConfig { diff --git a/src/prompt/mod.rs b/src/prompt/mod.rs index 2dccc17..d62db10 100644 --- a/src/prompt/mod.rs +++ b/src/prompt/mod.rs @@ -6,9 +6,12 @@ mod structure; use std::{io, io::Write, str::FromStr}; -use crate::prompt::{ - builtins::{builtin_echo, builtin_history, BuiltIn}, - structure::Command, +use crate::{ + config::Config, + prompt::{ + builtins::{builtin_echo, builtin_history, BuiltIn}, + structure::Command, + }, }; pub struct Prompt { @@ -30,7 +33,7 @@ impl Prompt { } fn write_prompt() { - print!("> "); + print!("{} ", Config::get().unwrap().whirlsplash.prompt_ps1); io::stdout().flush().unwrap(); } |