Don't format the prompt.
parent
ef2bb9cc1f
commit
27c097eb72
|
@ -43,12 +43,15 @@ Running `bootstrap` with these two files configured will invoke the following
|
|||
interactive script:
|
||||
```bash
|
||||
> bootstrap example
|
||||
What file should I create for you? hello-world.txt
|
||||
Creating hello-world.txt
|
||||
I: What file should I create for you? hello-world.txt
|
||||
O: Creating hello-world.txt
|
||||
|
||||
>
|
||||
```
|
||||
You should now see a new `hello-world.txt` file in the current directory.
|
||||
Here the line prefixed with `I:` indicates a prompt that must be answered by
|
||||
the user. The line prefixed with `O:` indicates the output of the builder
|
||||
script. You should now see a new `hello-world.txt` file in your current working
|
||||
directory.
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -46,9 +46,10 @@ static const char *prompt_field(struct Field *field) {
|
|||
|
||||
switch (field->type) {
|
||||
case FT_STRING:
|
||||
printf("%s> ", field->prompt);
|
||||
char *input = calloc(1, 256);
|
||||
if (fgets(input, 256, stdin)) {
|
||||
printf("%s", field->prompt);
|
||||
// TODO: Probably want this buffer size to be a bit more dynamic.
|
||||
char *input = calloc(1, 1024);
|
||||
if (fgets(input, 1024, stdin)) {
|
||||
size_t len = strlen(input);
|
||||
if (len > 0 && input[len - 1] == '\n') {
|
||||
input[len - 1] = '\0';
|
||||
|
|
Loading…
Reference in New Issue