Change grammar arg to "repo"

This commit is contained in:
karoel2 2022-06-15 09:31:07 +02:00
parent c2a9619ac7
commit 6263ac9d2b
2 changed files with 8 additions and 7 deletions

View File

@ -57,6 +57,7 @@ error_time = ["Podano nie prawidłowy czas, popraw ramy czasowe", "Czas jest nie
error_repo = ["Podano nieprawidłową nazwę repozytorium", "Podaj ponownie nazwę repozytorium, ponieważ podania nie prawidłową"] error_repo = ["Podano nieprawidłową nazwę repozytorium", "Podaj ponownie nazwę repozytorium, ponieważ podania nie prawidłową"]
def find(args, key): def find(args, key):
print(args, key)
for item in args: for item in args:
if item[0] == key: if item[0] == key:
return item return item
@ -71,13 +72,13 @@ def generator_jezyka_nautalnego(frame, tactic, state, text):
elif tactic[0] == False: #ASK elif tactic[0] == False: #ASK
_, required_empty, act, req_args, opt_args = tactic _, required_empty, act, req_args, opt_args = tactic
print('DEBUG: ', act, req_args, opt_args,sep = '\n') print('DEBUG: ', act, 'req', req_args, opt_args,sep = '\n')
print(f'Proszę podaj {required_empty[0]}') print(f'Proszę podaj {required_empty[0]}')
print() print()
elif tactic[0] == True: elif tactic[0] == True:
_, act, req_args, opt_args = tactic _, act, req_args, opt_args = tactic
print('DEBUG: ', act, req_args, opt_args,sep = '\n') print('DEBUG: ', act, 'req', req_args, opt_args,sep = '\n')
if act == 'help': if act == 'help':
print(random.choice(help)) print(random.choice(help))
print("Dostępne komendy: \n - " + '\n - '.join(commands)) print("Dostępne komendy: \n - " + '\n - '.join(commands))
@ -91,8 +92,8 @@ def generator_jezyka_nautalnego(frame, tactic, state, text):
print(random.choice(welcome)) print(random.choice(welcome))
elif act == 'issues': elif act == 'issues':
print("Lista issues w repozytorium " + find(req_args, repo) + ":") print("Lista issues w repozytorium " + find(req_args, 'repo')[0] + ":")
issues = listRepositoryIssues(find(req_args, repo)) issues = listRepositoryIssues(find(req_args, 'repo'))
for issue in issues: for issue in issues:
print(issue['name']) print(issue['name'])
print(issue['description']) print(issue['description'])
@ -100,7 +101,7 @@ def generator_jezyka_nautalnego(frame, tactic, state, text):
print() print()
elif act == 'pullrequest': elif act == 'pullrequest':
print("Lista pull requestów w repozytorium " + find(req_args, repo) + ":") print("Lista pull requestów w repozytorium " + find(req_args, 'repo')[0] + ":")
prs = listRepositoryPullRequests(find(req_args, repo)) prs = listRepositoryPullRequests(find(req_args, repo))
for pr in prs: for pr in prs:
print(pr['name']) print(pr['name'])

View File

@ -21,14 +21,14 @@ gramar_slots = {
'issues': (('time_when','optional'), 'issues': (('time_when','optional'),
('liczba','optional'), ('liczba','optional'),
('timeunit','optional'), ('timeunit','optional'),
('repozytoria', 'required') ('repo', 'required')
), ),
'number': (('liczba', 'required') 'number': (('liczba', 'required')
), ),
'help': (('functions', 'optional'), 'help': (('functions', 'optional'),
('help', 'optional') ('help', 'optional')
), ),
'repo': (('repozytoria', 'required') 'repo': (('repo', 'required')
), ),
'hello': (), 'hello': (),
'bye': (), 'bye': (),