aboutsummaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-04 14:55:00 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-04 14:55:00 -0400
commit05bc754679ca5b136b2f3a70b791db71e9260234 (patch)
tree359ed3458c2f116e122e9b7b1f1a215d4f40e4a7 /environment.c
parent570c4c63caa6ea4341339b3925a0d823c4ff8d15 (diff)
Add ask() as a way to get user input
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/environment.c b/environment.c
index eb456030..32e3f7f6 100644
--- a/environment.c
+++ b/environment.c
@@ -30,8 +30,17 @@ env_t *new_compilation_unit(CORD *libname)
const char *name;
binding_t binding;
} global_vars[] = {
- {"say", {.code="say", .type=Type(FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE,
- .next=new(arg_t, .name="newline", .type=Type(BoolType), .default_val=FakeAST(Bool, true))), .ret=Type(VoidType))}},
+ {"say", {.code="say", .type=Type(
+ FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE,
+ .next=new(arg_t, .name="newline", .type=Type(BoolType), .default_val=FakeAST(Bool, true))),
+ .ret=Type(VoidType))}},
+ {"ask", {.code="ask", .type=Type(
+ FunctionType, .args=new(arg_t, .name="prompt", .type=TEXT_TYPE,
+ .next=new(arg_t, .name="bold", .type=Type(BoolType),
+ .default_val=FakeAST(Bool, true),
+ .next=new(arg_t, .name="force_tty", .type=Type(BoolType),
+ .default_val=FakeAST(Bool, true)))),
+ .ret=TEXT_TYPE)}},
{"fail", {.code="fail", .type=Type(FunctionType, .args=new(arg_t, .name="message", .type=Type(CStringType)), .ret=Type(AbortType))}},
{"USE_COLOR", {.code="USE_COLOR", .type=Type(BoolType)}},
};