From 385ba28608855b3eb52643293f0d43ae0a24aba7 Mon Sep 17 00:00:00 2001 From: Karl Voit Date: Sun, 18 Nov 2018 22:55:51 +0100 Subject: [PATCH] print help when no parameter is given --- appendfilename/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/appendfilename/__init__.py b/appendfilename/__init__.py index cc2dd6f..a8cda51 100755 --- a/appendfilename/__init__.py +++ b/appendfilename/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -PROG_VERSION = u"Time-stamp: <2018-02-03 18:00:59 vk>" +PROG_VERSION = u"Time-stamp: <2018-11-18 22:55:19 vk>" # TODO: # * fix parts marked with «FIXXME» @@ -321,6 +321,11 @@ def main(): error_exit(1, "Options \"--verbose\" and \"--quiet\" found. " + "This does not make any sense, you silly fool :-)") + if len(sys.argv) < 2: + # not a single command line parameter is given -> print help instead of asking for a string + parser.print_help() + sys.exit(0) + text = options.text if not text: