Skip to content

Commit

Permalink
feat(update): show when no updates are available
Browse files Browse the repository at this point in the history
  • Loading branch information
vanutp committed Dec 26, 2021
1 parent 81962c1 commit 62145ff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tgpy/run_code/builtin_functions.py
Expand Up @@ -45,6 +45,7 @@ def restart(msg: Optional[str] = 'Restarted successfully'):

@save_function_to_variables
def update():
old_version = get_version()
if installed_as_package():
update_args = [sys.executable, '-m', 'pip', 'install', '-U', 'tgpy']
try:
Expand All @@ -53,7 +54,11 @@ def update():
run_cmd(update_args + ['--user'])
else:
run_cmd(['git', 'pull'])
restart(f'Updated successfully! Current version: {get_version()}')
new_version = get_version()
if old_version == new_version:
return 'Already up to date'
else:
restart(f'Updated successfully! Current version: {new_version}')


class HooksObject:
Expand Down

0 comments on commit 62145ff

Please sign in to comment.