feat(users/Profpatsch/execline/exec_helpers): add args()
Some programs need an exact amount of arguments, and we want to fail if they get too many or not enough. Change-Id: Ic703949f38780718f26118b896e7c7d7aa5553d9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2504 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
parent
060600f0d7
commit
81122c1297
2 changed files with 11 additions and 1 deletions
|
|
@ -109,7 +109,7 @@ let
|
|||
|
||||
fn main() {
|
||||
let mut buf = vec![];
|
||||
let (args, prog) = exec_helpers::args_for_exec("record-get", 1);
|
||||
let args = exec_helpers::args("record-get", 1);
|
||||
let field = match std::str::from_utf8(&args[0]) {
|
||||
Ok(f) => f,
|
||||
Err(_e) => exec_helpers::die_user_error("record-get", format!("The field name needs to be valid unicode"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue