From f8d9e5a2392af0ac33bc7ffc06a8c94748acb133 Mon Sep 17 00:00:00 2001 From: Andrew Mussey Date: Sun, 31 Mar 2019 23:54:49 -0700 Subject: [PATCH] Add a help dialog to hcltool. --- scripts/hcltool | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/hcltool b/scripts/hcltool index 78cac14..2f80ac0 100644 --- a/scripts/hcltool +++ b/scripts/hcltool @@ -18,7 +18,17 @@ import sys import json import hcl +HELP_DIALOG = """{filename} [infile [outfile]] + +If `infile` is not provided, `infile` defaults to `stdin`. +If `outfile` is not provided, `outfile` defaults to `stdout`.""" + def main(): + help_args = ['-h', '--help'] + if any([x for x in sys.argv if x.lower() in help_args]): + print(HELP_DIALOG.format(filename=sys.argv[0])) + return + if len(sys.argv) == 1: infile = sys.stdin outfile = sys.stdout