From 26666f0c001a4807d5bb9de981211c1d3dc984aa Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 8 Apr 2017 14:13:02 +0100 Subject: adds support for '-' as stdin for gitano-setup --- bin/gitano-setup.in | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/gitano-setup.in b/bin/gitano-setup.in index 9e6bfaa..86b2e08 100644 --- a/bin/gitano-setup.in +++ b/bin/gitano-setup.in @@ -60,11 +60,19 @@ local conf = clod.parse("") gitano.log.set_prefix("gitano-setup") gitano.log.bump_level(gitano.log.level.CHAT) +local force_batch = false for i = #possible_answers, 1, -1 do local answer_file = possible_answers[i] gitano.log.debug(gitano.i18n.expand("SETUP_DEBUG_PARSING_ANSWERS", { file=answer_file })) - local file_content = assert(io.open(answer_file, "r")):read "*a" - local file_name = "@" .. answer_file + local file_content, file_name + if answer_file == "-" then + file_content = io.stdin:read "*a" + file_name = "@stdin" + force_batch = true + else + file_content = assert(io.open(answer_file, "r")):read "*a" + file_name = "@" .. answer_file + end local one_conf = assert(clod.parse(file_content, file_name)) gitano.log.debug(gitano.i18n.expand("SETUP_DEBUG_COMBINE_ANSWERS")) for k,v in one_conf:each() do @@ -73,6 +81,10 @@ for i = #possible_answers, 1, -1 do end end +if force_batch then + conf.settings["setup.batch"] = true +end + gitano.log.chat(gitano.i18n.expand("SETUP_WELCOME")) gitano.log.chat(gitano.i18n.expand("SETUP_DO_CHECKS")) -- cgit v1.2.1