mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
final adding
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
test
|
||||
q
|
||||
P
|
||||
q
|
||||
S
|
||||
S --host 125
|
||||
q
|
||||
S --host 125.0123
|
||||
0
|
||||
U
|
||||
q
|
||||
+6
-30
@@ -1,32 +1,8 @@
|
||||
import readline
|
||||
from rich.console import Console
|
||||
from rich.markup import escape
|
||||
|
||||
|
||||
def completer(text, state):
|
||||
matches = sorted(cmd for cmd in get_history_items() if cmd.startswith(text))
|
||||
if len(matches) > 1:
|
||||
common_prefix = matches[0]
|
||||
for match in matches[1:]:
|
||||
i = 0
|
||||
while i < len(common_prefix) and i < len(match) and common_prefix[i] == match[i]:
|
||||
i += 1
|
||||
common_prefix = common_prefix[:i]
|
||||
if state == 0:
|
||||
readline.insert_text(common_prefix[len(text):])
|
||||
readline.redisplay()
|
||||
return None
|
||||
elif len(matches) == 1:
|
||||
return matches[0] if state == 0 else None
|
||||
else:
|
||||
return None
|
||||
|
||||
readline.set_completer(completer)
|
||||
readline.parse_and_bind("tab: complete")
|
||||
|
||||
def get_history_items():
|
||||
return [readline.get_history_item(i) for i in range(1, readline.get_current_history_length() + 1)]
|
||||
|
||||
while True:
|
||||
try:
|
||||
line = input('> ')
|
||||
except EOFError:
|
||||
break
|
||||
console = Console()
|
||||
text = lambda command, description: f'[bold red]{escape('['+command+']')}[/bold red] [blue dim]*=*=*[/blue dim] [bold yellow italic]{escape(description)}'
|
||||
print(text('start', 'command start'))
|
||||
console.print(text('start', 'command start'))
|
||||
|
||||
@@ -14,17 +14,17 @@ settings_router: Router = Router(title='Settings points:')
|
||||
console = Console()
|
||||
|
||||
|
||||
@work_router.command(Command('0', 'Get Help'))
|
||||
@work_router.command(Command('get', 'Get Help'))
|
||||
def command_help():
|
||||
help_command()
|
||||
|
||||
|
||||
@work_router.command(Command('S', 'Start Solving', Flags(PredeterminedFlags.HOST, PredeterminedFlags.PORT)))
|
||||
@work_router.command(Command('start', 'Start Solving', Flags(PredeterminedFlags.HOST, PredeterminedFlags.PORT)))
|
||||
def command_start_solving(args: InputFlags):
|
||||
print(args.get_flag('test'))
|
||||
|
||||
|
||||
@settings_router.command(Command('U', 'Update WordMath'))
|
||||
@settings_router.command(Command('update', 'Update WordMath'))
|
||||
def command_update():
|
||||
print('eeeeeee')
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from argenta.app.dividing_line import DynamicDividingLine
|
||||
from argenta.app.autocompleter import AutoCompleter
|
||||
|
||||
|
||||
autocompleter = AutoCompleter('./mock/.history')
|
||||
autocompleter = AutoCompleter()
|
||||
app: App = App(dividing_line=DynamicDividingLine(),
|
||||
autocompleter=autocompleter)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user