added auto-complete

This commit is contained in:
Fierelier 2019-07-22 08:49:04 +02:00
parent 429c5dacb7
commit 152d372cf8
1 changed files with 14 additions and 1 deletions

View File

@ -3,6 +3,8 @@ import sys
import os
import subprocess
import configparser
import readline
readline.parse_and_bind("tab: complete")
sp = os.path.dirname(os.path.realpath(__file__))
p = os.path.join
@ -73,6 +75,14 @@ def launchPrefix(prefix,cmd,raw = False):
del os.environ["WINEPREFIX"]
del configVars["prefix"]
def finput(dir,text = ""):
cd = os.getcwd()
os.chdir(dir)
inp = input(text)
if (len(inp) > 0):
if (inp[len(inp) - 1]) == "/": inp = inp[:len(inp) - 1]
os.chdir(cd)
return inp
def main():
args = sys.argv[1:]
@ -91,12 +101,15 @@ def main():
while True:
prefixLocation = cv(config["DEFAULT"]["prefixLocation"])
if not (os.path.isdir(prefixLocation)):
os.makedirs(prefixLocation)
print("list of prefixes:")
for root,dirs,files in walklevel(prefixLocation):
for dir in dirs:
print(dir)
prefix = input("\nprefix: ")
prefix = finput(prefixLocation,"\nprefix: ")
prefixFolder = p(prefixLocation,prefix)
if not os.path.isdir(prefixFolder):