-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --argjson support #250
base: main
Are you sure you want to change the base?
Conversation
let v = lexer | ||
.exactly_one(Val::parse) | ||
.map_err(|e| Error::Parse(format!("cannot parse {s} as JSON: {e}"))); | ||
Ok::<(std::string::String, Val), Error>((k.to_owned(), v?)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rust knowledge fails me here, compiler not happy about deriving type parameter E for Result without this. Also looking at the other code i guess maybe you would like to refactor this to share parsing of json somehow?
let mut lexer = hifijson::SliceLexer::new(s.as_bytes()); | ||
let v = lexer | ||
.exactly_one(Val::parse) | ||
.map_err(|e| Error::Parse(format!("cannot parse {s} as JSON: {e}"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably skip or truncate s
and mention k
in error message
"argjson" => { | ||
let (name, value) = parse_key_val("--argjson", args)?; | ||
self.argjson.push((name, value.into_string()?)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i understand code i cli just collects stings, reading files, parsing etc should happen in binds?
And hope your having great holidays! |
Fixes #180