forked from extern/nushell
enable cd to work with directory abbreviations (#5452)
* enable cd to work with abbreviations * add abbreviation example * fix tests * make it configurable
This commit is contained in:
@ -49,6 +49,7 @@ pub struct Config {
|
||||
pub shell_integration: bool,
|
||||
pub buffer_editor: String,
|
||||
pub disable_table_indexes: bool,
|
||||
pub cd_with_abbreviations: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -77,6 +78,7 @@ impl Default for Config {
|
||||
shell_integration: false,
|
||||
buffer_editor: String::new(),
|
||||
disable_table_indexes: false,
|
||||
cd_with_abbreviations: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,7 +267,6 @@ impl Value {
|
||||
eprintln!("$config.buffer_editor is not a string")
|
||||
}
|
||||
}
|
||||
|
||||
"disable_table_indexes" => {
|
||||
if let Ok(b) = value.as_bool() {
|
||||
config.disable_table_indexes = b;
|
||||
@ -273,6 +274,13 @@ impl Value {
|
||||
eprintln!("$config.disable_table_indexes is not a bool")
|
||||
}
|
||||
}
|
||||
"cd_with_abbreviations" => {
|
||||
if let Ok(b) = value.as_bool() {
|
||||
config.cd_with_abbreviations = b;
|
||||
} else {
|
||||
eprintln!("$config.disable_table_indexes is not a bool")
|
||||
}
|
||||
}
|
||||
x => {
|
||||
eprintln!("$config.{} is an unknown config setting", x)
|
||||
}
|
||||
|
@ -636,6 +636,27 @@ Either make sure {0} is a string, or add a 'to_string' entry for it in ENV_CONVE
|
||||
String,
|
||||
#[label = "'{0}' is deprecated. Please use '{1}' instead."] Span,
|
||||
),
|
||||
|
||||
/// Non-Unicode input received.
|
||||
///
|
||||
/// ## Resolution
|
||||
///
|
||||
/// Check that your path is UTF-8 compatible.
|
||||
#[error("Non-Unicode input received.")]
|
||||
#[diagnostic(code(nu::shell::non_unicode_input), url(docsrs))]
|
||||
NonUnicodeInput,
|
||||
|
||||
// /// Path not found.
|
||||
// #[error("Path not found.")]
|
||||
// PathNotFound,
|
||||
/// Unexpected abbr component.
|
||||
///
|
||||
/// ## Resolution
|
||||
///
|
||||
/// Check the path abbreviation to ensure that it is valid.
|
||||
#[error("Unexpected abbr component `{0}`.")]
|
||||
#[diagnostic(code(nu::shell::unexpected_path_abbreviateion), url(docsrs))]
|
||||
UnexpectedAbbrComponent(String),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for ShellError {
|
||||
|
Reference in New Issue
Block a user