Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

La til en "open_file"-funksjon i worblehat.py, som brukes for å åpne filer i $EDITOR.

This commit is contained in:
Jabir Ali Ouassou 2011-03-05 17:39:14 +00:00
parent eb7430371c
commit 3978b41456
1 changed files with 7 additions and 0 deletions

View File

@ -213,6 +213,13 @@ def combine_dicts(*dicts):
res.update(d)
return res
def open_file(filename):
if os.path.exists(filename):
os.system("%s %s || /usr/bin/env vi %s" %(os.getenv("EDITOR"), filename, filename))
else:
exit("Error: %s: File does not exist!" % filename)
cmdline_parsed = parse_cmdline(sys.argv[1:])
print 'command line parsed to:', cmdline_parsed