From 7006ff11f11c66fcc70d066c2024fc6a7bd7dd53 Mon Sep 17 00:00:00 2001 From: noah morrison Date: Tue, 18 Nov 2014 16:08:05 -0500 Subject: [PATCH] Started pip-ability Moved chevron.py to chevron/ Added cli_main function that is now called on __main__ (because __main__ is not callable from pip) Print usage when not given enough arguments --- chevron.py => chevron/chevron.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename chevron.py => chevron/chevron.py (98%) diff --git a/chevron.py b/chevron/chevron.py similarity index 98% rename from chevron.py rename to chevron/chevron.py index 535edad..812106b 100755 --- a/chevron.py +++ b/chevron/chevron.py @@ -393,5 +393,11 @@ def main(data, template, **kwargs): args.update(kwargs) return render(**args) +def cli_main(): + try: + print(main(argv[1], argv[2])) + except IndexError: + print('usage: chevron [Json file] [Mustache file]') + if __name__ == '__main__': - print(main(argv[1], argv[2])) + cli_main() -- 2.47.3