MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / execute

Method execute

keepercommander/commands/utils.py:1673–1710  ·  view source on GitHub ↗
(self, params, **kwargs)

Source from the content-addressed store, hash-verified

1671 return False
1672
1673 def execute(self, params, **kwargs):
1674 method = updater.detect_install_method()
1675 info = updater.get_install_info()
1676 proxies = params.rest_context.proxies
1677
1678 if not info:
1679 # Not installed with the install script: show how to update this kind of installation.
1680 details = is_up_to_date_version(params)
1681 latest = details.get('current_github_version')
1682 if details.get('is_up_to_date') is False and latest:
1683 print('Keeper Commander {0} is available (you have {1}).'.format(latest, __version__))
1684 elif details.get('is_up_to_date') is None and not latest:
1685 print('Cannot check for updates (offline?). You have {0}.'.format(__version__))
1686 else:
1687 print('Keeper Commander {0} is up to date.'.format(__version__))
1688 print('Installed via {0}. {1}'.format(updater.METHOD_NAMES.get(method, method),
1689 updater.get_update_instructions(method)))
1690 return
1691
1692 try:
1693 meta = updater.get_latest(info, proxies)
1694 latest = meta['version']
1695 if not updater.is_newer(latest):
1696 print('Keeper Commander {0} is up to date.'.format(__version__))
1697 return
1698 print('Keeper Commander {0} is available (you have {1}).'.format(latest, __version__))
1699 if kwargs.get('check_only'):
1700 print("Run 'update' to install it.")
1701 return
1702 if not kwargs.get('yes'):
1703 answer = input('Update now? [y/N]: ').strip().lower()
1704 if answer not in ('y', 'yes'):
1705 return
1706 updater.perform_update(info, meta=meta, proxies=proxies)
1707 except updater.UpdateError as e:
1708 raise CommandError('update', str(e))
1709 except (EOFError, KeyboardInterrupt):
1710 print('')
1711
1712
1713class KeepAliveCommand(Command):

Callers

nothing calls this directly

Calls 4

is_up_to_date_versionFunction · 0.85
formatMethod · 0.80
CommandErrorClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected