La til en "open_file"-funksjon i worblehat.py, som brukes for å åpne filer i $EDITOR.
This commit is contained in:
parent
eb7430371c
commit
3978b41456
|
@ -213,6 +213,13 @@ def combine_dicts(*dicts):
|
||||||
res.update(d)
|
res.update(d)
|
||||||
return res
|
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:])
|
cmdline_parsed = parse_cmdline(sys.argv[1:])
|
||||||
print 'command line parsed to:', cmdline_parsed
|
print 'command line parsed to:', cmdline_parsed
|
||||||
|
|
Reference in New Issue