mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 20:27:44 +02:00
Treating environment variables as Values (#497)
* Proof of concept treating env vars as Values * Refactor env var collection and method name * Remove unnecessary pub * Move env translations into a new file * Fix LS_COLORS to support any Value * Fix spans during env var translation * Add span to env var in cd * Improve error diagnostics * Fix non-string env vars failing string conversion * Make PROMPT_COMMAND a Block instead of String * Record host env vars to a fake file This will give spans to env vars that would otherwise be without one. Makes errors less confusing. * Add 'env' command to list env vars It will list also their values translated to strings * Sort env command by name; Add env var type * Remove obsolete test
This commit is contained in:
@ -8,7 +8,6 @@ use {
|
||||
/// Nushell prompt definition
|
||||
#[derive(Clone)]
|
||||
pub struct NushellPrompt {
|
||||
prompt_command: String,
|
||||
prompt_string: String,
|
||||
// These are part of the struct definition in case we want to allow
|
||||
// further customization to the shell status
|
||||
@ -27,7 +26,6 @@ impl Default for NushellPrompt {
|
||||
impl NushellPrompt {
|
||||
pub fn new() -> NushellPrompt {
|
||||
NushellPrompt {
|
||||
prompt_command: "".to_string(),
|
||||
prompt_string: "".to_string(),
|
||||
default_prompt_indicator: "〉".to_string(),
|
||||
default_vi_insert_prompt_indicator: ": ".to_string(),
|
||||
@ -36,12 +34,7 @@ impl NushellPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_new_prompt(&self, prompt_command: &str) -> bool {
|
||||
self.prompt_command != prompt_command
|
||||
}
|
||||
|
||||
pub fn update_prompt(&mut self, prompt_command: String, prompt_string: String) {
|
||||
self.prompt_command = prompt_command;
|
||||
pub fn update_prompt(&mut self, prompt_string: String) {
|
||||
self.prompt_string = prompt_string;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user