From c66e5dc90c8495d5efd9368dbe7210a8eac5304b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 15 Jan 2018 22:47:11 +0100 Subject: [PATCH] Option to bypass the confirmation check in ESPurna OTA Manager --- code/ota.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/ota.py b/code/ota.py index afc65e0b..699abc1d 100644 --- a/code/ota.py +++ b/code/ota.py @@ -216,6 +216,7 @@ if __name__ == '__main__': parser.add_argument("-o", "--flags", help="extra flags", default='') parser.add_argument("-p", "--password", help="auth password", default='') parser.add_argument("-s", "--sort", help="sort devices list by field", default='hostname') + parser.add_argument("-y", "--yes", help="do not ask for confirmation", default=0, action='count') parser.add_argument("hostnames", nargs='*', help="Hostnames to update") args = parser.parse_args() @@ -287,7 +288,9 @@ if __name__ == '__main__': print("FLAGS = %s" % board['flags']) print("ENV = %s" % env) - response = input("\nAre these values right [y/N]: ") - print() - if response == "y": + response = True + if args.yes == 0: + response = (input("\nAre these values right [y/N]: ") == "y") + if response: + print() run(board, env)