def main(): try: opts, args = getopt.getopt( sys.argv[1:], "hl", ["help", "less"] ) except: usage() justread = False for o, a in opts: if o == '-h' or o == "--help": usage() if o in ("-l", "--less"): justread = True file_to_edit = nfilename.newest_filename( dijara_home(), True ) command = edit_command(justread) + " " + file_to_edit print_debug( command ) os.system( command )
#!/usr/bin/python import nfilename import bcolors import sys sys.stdout.write(bcolors.bcolors.WARNING) print nfilename.newest_filename( ".", True ) sys.stdout.write(bcolors.bcolors.ENDC) sys.stdout.write(bcolors.bcolors.HEADER) print nfilename.newest_filename( ".", True ) sys.stdout.write(bcolors.bcolors.ENDC) sys.stdout.write(bcolors.bcolors.OKBLUE) print nfilename.newest_filename( ".", True ) sys.stdout.write(bcolors.bcolors.ENDC) sys.stdout.write(bcolors.bcolors.OKGREEN) print nfilename.newest_filename( ".", True ) sys.stdout.write(bcolors.bcolors.ENDC) sys.stdout.write(bcolors.bcolors.FAIL) print nfilename.newest_filename( ".", True ) sys.stdout.write(bcolors.bcolors.ENDC)