allow int and float as strings for arguments (#4615)

* allow int and float as strings for arguments

* consume iterator
This commit is contained in:
Fernando Herrera
2022-02-24 05:09:02 +00:00
committed by GitHub
parent 4b18fdcc6e
commit 21c0f7d738
2 changed files with 26 additions and 32 deletions

View File

@ -173,6 +173,8 @@ impl Clone for Value {
impl Value {
pub fn as_string(&self) -> Result<String, ShellError> {
match self {
Value::Int { val, .. } => Ok(val.to_string()),
Value::Float { val, .. } => Ok(val.to_string()),
Value::String { val, .. } => Ok(val.to_string()),
Value::Binary { val, .. } => Ok(match std::str::from_utf8(val) {
Ok(s) => s.to_string(),