Added an init line in sqishrc
This commit is contained in:
parent
c06afb410c
commit
0bf2c601c3
@ -3,7 +3,6 @@ Rust Shell. This is an attempt to create a simple shell in Rust, because why not
|
|||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
* git commit -m "message" does not work
|
* git commit -m "message" does not work
|
||||||
* Startup script section in sqishrc
|
|
||||||
|
|
||||||
## sqishrc (Config)
|
## sqishrc (Config)
|
||||||
See the included sqishrc file included, and copy it as ~/.sqishrc
|
See the included sqishrc file included, and copy it as ~/.sqishrc
|
||||||
|
@ -342,6 +342,7 @@ pub mod shell {
|
|||||||
promptline_base: String::from("!$HISTNUMBER_$COLORGREEN_[$USER_@$HOSTNAME_]$COLORRESET_ "),
|
promptline_base: String::from("!$HISTNUMBER_$COLORGREEN_[$USER_@$HOSTNAME_]$COLORRESET_ "),
|
||||||
aliases: HashMap::new(),
|
aliases: HashMap::new(),
|
||||||
hotkeys: HashMap::new(),
|
hotkeys: HashMap::new(),
|
||||||
|
init: String::new(),
|
||||||
};
|
};
|
||||||
let ret_line = format!("Could not build conf, got {}\
|
let ret_line = format!("Could not build conf, got {}\
|
||||||
\r\nUsing default promptline", e);
|
\r\nUsing default promptline", e);
|
||||||
@ -351,10 +352,14 @@ pub mod shell {
|
|||||||
};
|
};
|
||||||
&conf.update_prompt(get_curr_history_number());
|
&conf.update_prompt(get_curr_history_number());
|
||||||
|
|
||||||
//Initialize
|
//Initializing
|
||||||
write!(stdout, "\r\n SquiShell (sqish)--- \r\n{}", conf.promptline);
|
write!(stdout, "\r\n ---Sqish initializing...--- \r\n{}", conf.promptline);
|
||||||
stdout.flush();
|
stdout.flush();
|
||||||
|
|
||||||
|
if conf.init != String::from("") {
|
||||||
|
run_cmd(&mut String::from(&conf.init), &mut current_number, &mut conf, &mut stdout);
|
||||||
|
}
|
||||||
|
|
||||||
for c in stdin.keys() {
|
for c in stdin.keys() {
|
||||||
let k = c.unwrap();
|
let k = c.unwrap();
|
||||||
match k {
|
match k {
|
||||||
|
@ -15,6 +15,7 @@ pub struct SqishConf {
|
|||||||
pub promptline_base: String,
|
pub promptline_base: String,
|
||||||
pub aliases: HashMap<String, String>,
|
pub aliases: HashMap<String, String>,
|
||||||
pub hotkeys: HashMap<String, String>,
|
pub hotkeys: HashMap<String, String>,
|
||||||
|
pub init: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SqishConf {
|
impl SqishConf {
|
||||||
@ -42,7 +43,8 @@ impl SqishConf {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let sqishrc = &sqishrc[0];
|
let sqishrc = &sqishrc[0];
|
||||||
let out_str = String::from(sqishrc["prompt"].as_str().unwrap());
|
let out_str = String::from(sqishrc["prompt"].as_str().unwrap_or("$ "));
|
||||||
|
let startup = String::from(sqishrc["init"].as_str().unwrap_or(""));
|
||||||
|
|
||||||
//Loading hotkeys and aliases from yaml
|
//Loading hotkeys and aliases from yaml
|
||||||
//They can be empty, be careful...
|
//They can be empty, be careful...
|
||||||
@ -57,6 +59,7 @@ impl SqishConf {
|
|||||||
promptline_base: out_str,
|
promptline_base: out_str,
|
||||||
aliases: aliases,
|
aliases: aliases,
|
||||||
hotkeys: hotkeys,
|
hotkeys: hotkeys,
|
||||||
|
init: startup,
|
||||||
};
|
};
|
||||||
|
|
||||||
out_conf.handle_rgb();
|
out_conf.handle_rgb();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user