|
|
|
@ -14,7 +14,7 @@ list_directory="ls --color=auto"
|
|
|
|
|
def set_runtime_var(name, value, options=""):
|
|
|
|
|
if ( shell == "fish" ):
|
|
|
|
|
print("set "+name+" "+options+" \""+value+"\"")
|
|
|
|
|
elif ( shell == "bash" || shell == "zsh" ):
|
|
|
|
|
elif ( shell == "bash" or shell == "zsh" ):
|
|
|
|
|
print("export "+name+"="+"\""+value+"\"")
|
|
|
|
|
|
|
|
|
|
def is_binary_file(filepathname):
|
|
|
|
@ -38,10 +38,10 @@ def file_len(fname):
|
|
|
|
|
|
|
|
|
|
# bootstrap the config
|
|
|
|
|
ENV_HOME=os.environ['HOME']
|
|
|
|
|
subprocess.call(['mkdir', '-p', ENV_HOME+'/.config'])
|
|
|
|
|
if ( os.path.isfile(ENV_HOME+'/.config/what.config') ):
|
|
|
|
|
subprocess.call(['mkdir', '-p', ENV_HOME+'/.config/do_what'])
|
|
|
|
|
if ( os.path.isfile(ENV_HOME+'/.config/do_what/what.config') ):
|
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
|
config.read(ENV_HOME+'/.config/what.config')
|
|
|
|
|
config.read(ENV_HOME+'/.config/do_what/what.config')
|
|
|
|
|
if ( 'DEFAULT' in config ):
|
|
|
|
|
if ( 'print_file' in config['DEFAULT'] ):
|
|
|
|
|
print_file = config['DEFAULT']['print_file']
|
|
|
|
@ -60,7 +60,7 @@ else:
|
|
|
|
|
'print_file': print_file
|
|
|
|
|
}
|
|
|
|
|
print("echo Default config loaded.")
|
|
|
|
|
with open(ENV_HOME+'/.config/what.config', 'w') as configfile:
|
|
|
|
|
with open(ENV_HOME+'/.config/do_what/what.config', 'w') as configfile:
|
|
|
|
|
config.write(configfile)
|
|
|
|
|
configfile.close()
|
|
|
|
|
|
|
|
|
|