Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cfbs/prompts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

YES_NO_CHOICES = ("yes", "y", "no", "n")


Expand Down Expand Up @@ -53,8 +55,8 @@ def prompt_user_multiline(non_interactive: bool, prompt: str, default=None):

print(prompt)
print(
"(Enter one or more lines of text, then finish with double newline or Ctrl+D"
" (Ctrl+Z followed by Enter on Windows))"
"(Enter one or more lines of text, then finish with double newline or %s)"
% ("Ctrl+Z followed by enter" if sys.platform.startswith("win") else "Ctrl+D")
)

lines = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ cd ./tmp/
touch cfbs.json && rm cfbs.json
rm -rf .git
rm -rf create-single-file-with-content
cp ../shell/059_input_multilinestring/example-cfbs.json cfbs.json
cp ../shell/059_input_string_multiline/example-cfbs.json cfbs.json

cfbs --non-interactive input create-single-file-with-content
grep '"type": "string-multiline"' create-single-file-with-content/input.json
grep '"default": "Hello CFEngine!\\nBye CFEngine!"' create-single-file-with-content/input.json
grep '"response": "Hello CFEngine!\\nBye CFEngine!"' create-single-file-with-content/input.json

cfbs render-input create-single-file-with-content create-single-file-with-content/input.json actual.output
diff actual.output ../shell/059_input_multilinestring/expected-augment.json
diff actual.output ../shell/059_input_string_multiline/expected-augment.json
2 changes: 1 addition & 1 deletion tests/shell/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ run_test tests/shell/055_render_input_two_variables.sh
run_test tests/shell/056_render_input_list.sh
run_test tests/shell/057_render_input_no_response.sh
run_test tests/shell/058_render_input_fail.sh
run_test tests/shell/059_input_multilinestring.sh
run_test tests/shell/059_input_string_multiline.sh

# Summary
_suite_end=$(date +%s)
Expand Down
Loading