geotribu_cli.subcommands.upgrade module#

Sub-command in charge of checking if new versions are available.

Author: Julien M. (https://github.com/guts)

geotribu_cli.subcommands.upgrade.get_download_url_for_os(release_assets, override_opersys=None)#

Parse list of a GitHub release assets and return the appropriate download URL for the current operating system.

Paramètres:
  • release_assets (list) – list of assets

  • override_opersys (str, optional) – override current operating system code. Useful to get a download URL for a specific OS. Defaults to None.

Renvoie:

tuple containing asset download URL (browser_download_url) and

content-type (barely defined)

Type renvoyé:

tuple[str, str]

geotribu_cli.subcommands.upgrade.get_latest_release(api_repo_url)#

Get latest release from GitHub public API.

Paramètres:

api_repo_url (str) – API URL with the owner and repository set

Renvoie:

GitHub release object

Type renvoyé:

dict

geotribu_cli.subcommands.upgrade.parser_upgrade(subparser)#

Set the argument parser subcommand.

Paramètres:

subparser (argparse.ArgumentParser) – parser to set up

Renvoie:

parser ready to use

Type renvoyé:

argparse.ArgumentParser

geotribu_cli.subcommands.upgrade.replace_domain(url, new_domain='api.github.com/repos')#

Replaces the domain of an URL with a new domain.

Paramètres:
  • url (str) – The original URL.

  • new_domain (str, optional) – The new domain to replace the original domain with. Defaults to « api.github.com/repos ».

Renvoie:

The URL with the new domain.

Type renvoyé:

str

geotribu_cli.subcommands.upgrade.run(args)#

Run the sub command logic.

Check if a new version of the CLI is available and download it if needed.

Paramètres:

args (argparse.Namespace) – arguments passed to the subcommand