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:
Ian Manske
2023-07-21 13:20:33 +00:00
committed by GitHub
parent 0b1e368cea
commit 7e1b922ea7
30 changed files with 413 additions and 216 deletions

View File

@ -337,7 +337,7 @@ impl<'e, 's> ScopeData<'e, 's> {
Value::nothing(span),
Value::string("input", span),
Value::string(input_type.to_shape().to_string(), span),
Value::boolean(false, span),
Value::bool(false, span),
Value::nothing(span),
Value::nothing(span),
Value::nothing(span),
@ -352,7 +352,7 @@ impl<'e, 's> ScopeData<'e, 's> {
Value::string(&req.name, span),
Value::string("positional", span),
Value::string(req.shape.to_string(), span),
Value::boolean(false, span),
Value::bool(false, span),
Value::nothing(span),
Value::string(&req.desc, span),
Value::string(
@ -375,7 +375,7 @@ impl<'e, 's> ScopeData<'e, 's> {
Value::string(&opt.name, span),
Value::string("positional", span),
Value::string(opt.shape.to_string(), span),
Value::boolean(true, span),
Value::bool(true, span),
Value::nothing(span),
Value::string(&opt.desc, span),
Value::string(
@ -402,7 +402,7 @@ impl<'e, 's> ScopeData<'e, 's> {
Value::string(if rest.name == "rest" { "" } else { &rest.name }, span),
Value::string("rest", span),
Value::string(rest.shape.to_string(), span),
Value::boolean(true, span),
Value::bool(true, span),
Value::nothing(span),
Value::string(&rest.desc, span),
Value::string(
@ -449,7 +449,7 @@ impl<'e, 's> ScopeData<'e, 's> {
Value::string(&named.long, span),
flag_type,
shape,
Value::boolean(!named.required, span),
Value::bool(!named.required, span),
short_flag,
Value::string(&named.desc, span),
Value::string(custom_completion_command_name, span),
@ -474,7 +474,7 @@ impl<'e, 's> ScopeData<'e, 's> {
Value::nothing(span),
Value::string("output", span),
Value::string(output_type.to_shape().to_string(), span),
Value::boolean(false, span),
Value::bool(false, span),
Value::nothing(span),
Value::nothing(span),
Value::nothing(span),