graceful failure when grcat run without conffile (closes #5)

This commit is contained in:
Radovan Garabík 2015-03-17 14:26:50 +01:00
parent 41583f607d
commit 0ed1bb8da3
1 changed files with 4 additions and 0 deletions

4
grcat
View File

@ -87,6 +87,10 @@ conffile = None
if 'HOME' in os.environ:
home = [os.environ['HOME']+"/.grc/"]
conffilepath = [""] + home + ["/usr/local/share/grc/", "/usr/share/grc/"]
if len(sys.argv) != 2:
sys.stderr.write("You are not supposed to call grcat directly, but the usage is: grcat conffile\n")
sys.exit(1)
conffile_arg = sys.argv[1] # tentative conffile
for i in conffilepath:
if os.path.isfile(i+conffile_arg):