refactor(tvix/eval): use Clap for arg+env parsing
Refactor the environment variable and argument parsing for the tvix repl to use Clap instead of doing things ad-hoc, and thread through options obtained from environment variables via explicit arguments rather than obtaining them from the environment as they're needed. This makes adding more flags more sustainable, and also makes the binary fully self-documenting, including supported env vars, via `--help`. Change-Id: Ib1f6a0cd20056e8c9196760ff755fa5729667760 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6653 Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
6f70f32513
commit
e720545e5b
8 changed files with 168 additions and 29 deletions
|
|
@ -12,7 +12,8 @@ fn eval_okay_test(code_path: &str) {
|
|||
let code = std::fs::read_to_string(code_path).expect("should be able to read test code");
|
||||
let exp = std::fs::read_to_string(exp_path).expect("should be able to read test expectation");
|
||||
|
||||
let result = interpret(&code, None).expect("evaluation of eval-okay test should succeed");
|
||||
let result = interpret(&code, None, Default::default())
|
||||
.expect("evaluation of eval-okay test should succeed");
|
||||
let result_str = format!("{}", result);
|
||||
|
||||
assert_eq!(
|
||||
|
|
@ -28,7 +29,8 @@ fn eval_okay_test(code_path: &str) {
|
|||
fn identity(code_path: &str) {
|
||||
let code = std::fs::read_to_string(code_path).expect("should be able to read test code");
|
||||
|
||||
let result = interpret(&code, None).expect("evaluation of identity test should succeed");
|
||||
let result = interpret(&code, None, Default::default())
|
||||
.expect("evaluation of identity test should succeed");
|
||||
let result_str = format!("{}", result);
|
||||
|
||||
assert_eq!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue