mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 00:38:36 +02:00
Add functions for each Value
case (#9736)
# Description This PR ensures functions exist to extract and create each and every `Value` case. It also renames `Value::boolean` to `Value::bool` to match `Value::test_bool`, `Value::as_bool`, and `Value::Bool`. Similarly, `Value::as_integer` was renamed to `Value::as_int` to be consistent with `Value::int`, `Value::test_int`, and `Value::Int`. These two renames can be undone if necessary. # User-Facing Changes No user facing changes, but two public functions were renamed which may affect downstream dependents.
This commit is contained in:
@ -85,8 +85,8 @@ impl SimpleCommand for TweakCmd {
|
||||
|
||||
fn parse_value(value: &str) -> Value {
|
||||
match value {
|
||||
"true" => Value::boolean(true, NuSpan::unknown()),
|
||||
"false" => Value::boolean(false, NuSpan::unknown()),
|
||||
"true" => Value::bool(true, NuSpan::unknown()),
|
||||
"false" => Value::bool(false, NuSpan::unknown()),
|
||||
s => Value::string(s.to_owned(), NuSpan::unknown()),
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ fn insert_bool(map: &mut HashMap<String, Value>, key: &str, value: bool) {
|
||||
return;
|
||||
}
|
||||
|
||||
map.insert(String::from(key), Value::boolean(value, Span::unknown()));
|
||||
map.insert(String::from(key), Value::bool(value, Span::unknown()));
|
||||
}
|
||||
|
||||
fn include_nu_config(config: &mut HashMap<String, Value>, style_computer: &StyleComputer) {
|
||||
|
Reference in New Issue
Block a user