diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-04-08 14:13:02 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-04-08 14:52:55 +0100 |
commit | 26666f0c001a4807d5bb9de981211c1d3dc984aa (patch) | |
tree | 1832861ce219a80796ac94db8b17dee1c05da7fd | |
parent | 99fe28c973294b9a971256bea191ff160671c790 (diff) | |
download | gitano-26666f0c001a4807d5bb9de981211c1d3dc984aa.tar.gz |
adds support for '-' as stdin for gitano-setupdsilvers/gitano-setup-tweaks
-rw-r--r-- | bin/gitano-setup.in | 16 |
1 files 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")) |