Spaces:
Runtime error
Runtime error
File size: 1,297 Bytes
6309782 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
from prompt_toolkit import PromptSession
from mainLogic.utils.glv import Global
from mainLogic.startup.checkup import CheckState
import json
from mainLogic.utils.os2 import SysFunc
glv = Global()
EXECUTABLES = glv.EXECUTABLES
os2 = SysFunc()
# Initialize Prompt Toolkit session
session = PromptSession()
def main():
# Perform checkup and get preferences
# Hardcoded verbose to False
state = CheckState().checkup(EXECUTABLES, False)
prefs = state['prefs']
# Convert preferences to JSON string for display
prefs_json = json.dumps(prefs, indent=4)
# Define available commands for auto-completion
#commands = ['show_prefs', 'exit']
#completer = WordCompleter(commands, ignore_case=True)
from beta.shellLogic import logic
# Command-line interface loop
while True:
try:
user_input = session.prompt('|pwdl> ',)
# just in case the user hits enter without typing anything
if not user_input: continue
command = user_input.split()[0]
args = user_input.split()[1:]
if not args: args = []
logic.execute(command, args)
except KeyboardInterrupt:
continue
except EOFError:
break
if __name__ == "__main__":
main()
|