Changed to work on windows.

pull/11/head
Nicholas Hope 2022-08-04 16:19:45 -04:00
parent 1e3093ec58
commit 3828150d25
2 changed files with 7 additions and 12 deletions

2
cli.py
View File

@ -47,10 +47,10 @@ def parseConfig(config):
stringToWrite = tfscript.makeCFG(classDict)
outfile.write(stringToWrite.encode("utf8"))
outfile.close()
os.replace(outfile.name, f'{prefix}/{currentClass}_nscript.txt')
if args.debug:
print( f'DEBUG: Created {prefix}/{currentClass}_nscript.txt')
outfile.close()
# Main function
if __name__ == "__main__":

View File

@ -72,7 +72,7 @@ def impulse(key, instruction):
elif cmd == "build" or cmd == "destroy":
instruction = f"{cmd} " + expandBuildings(restOfCmd)
return f'// impulse\nbind {key} "{instruction}"\n'
return f'bind {key} "{instruction}"\n'
def voice(keyword):
keyword = keyword.lower()
@ -101,16 +101,13 @@ def expandBuildings(building):
def simpleHold(key, instruction):
# This isn't quite right, fix later!
ret = '// simple hold\n'
if instruction[0] != '+':
ret += f'bind {key} "+{instruction}"\n'
return += f'bind {key} "+{instruction}"\n'
else:
ret += f'bind {key} "{instruction}"\n'
return ret
return += f'bind {key} "{instruction}"\n'
def listHold(key, options):
ret = '// list hold\n' +\
f'alias +{key}_bind "{options["press"]}"\n' +\
ret = f'alias +{key}_bind "{options["press"]}"\n' +\
f'alias -{key}_bind "{options["release"]}"\n' +\
f'bind {key} "+{key}_bind"\n'
return ret
@ -120,8 +117,7 @@ def toggle(key, instruction):
offStr = f'turn_{key}_off'
togStr = f'toggle_{key}'
ret = '// toggle\n'+\
f'alias {onStr} "+{instruction}; alias {togStr} {offStr}"\n' +\
ret = f'alias {onStr} "+{instruction}; alias {togStr} {offStr}"\n' +\
f'alias {offStr} "-{instruction}; alias {togStr} {onStr}"\n' +\
f'alias {togStr} "{onStr}"\n' +\
f'bind {key} "{togStr}"\n'
@ -159,8 +155,7 @@ def double(key, options):
llist[i] = llist[i][0] + 'alias'
newcode.append(' '.join(llist))
ret = '// double\n' +\
'\n'.join(newcode) +\
ret = '\n'.join(newcode) +\
f'alias +{tog_str} "bind {key} {alt_str}"\n' +\
f'alias -{tog_str} "bind {key} {main_str}"\n'+\
f'bind {key} "{main_str}"\n'