Module brane_cli::utils

source ·
Expand description

Contains useful utilities used throughout the brane-cli package.

Enums§

  • If a dependency is not met, this enum lists which one and why not.

Functions§

  • Checks whether the given string is a valid name for Bakery.
  • Edited: Now returning UtilErrors.
  • Edited: now returning CliErrors.
  • Edited: not taking a context anymore, returning CliErrors and a PackageKind instead of a string.
  • Makes sure that Brane’s config directory exists and then returns its path.
  • Makes sure that Brane’s data directory exists, and then returns its path.
  • Makes sure that the dataset directory for the given dataset exists, then returns the path to it.
  • Makes sure that Brane’s dataset directory exists, and then returns its path.
    Basically, tries to resolve the folder ~/.local/share/brane/data.
  • Makes sure that the history file exists and then returns its path.
  • Gets the directory where we store the instance definition for the given instance and ensures it exists.
  • Gets the directory where we store instance definitions and ensures it exists.
  • Makes sure that the package directory for the given name/version pair exists, then returns the path to it.
    If the given version is omitted, just returns the package directory for this name.
    If the given version is latest, tries to find the latest version directory to return that; otherwise, always errors (regardless of ‘create’).
  • Makes sure that Brane’s packages directory exists, and then returns its path.
    Basically, tries to resolve the folder ’~/.local/share/brane/packages`.
  • Returns the path for the softlink that points to the active instance directory.
  • Edited: uses dirs instead of appdirs and returns UtilErrors when it goes wrong.
  • Returns the general data directory based on the user’s home folder.
  • Gets the directory where we likely stored a dataset.
    Does not guarantee that the directory also exists; check ensure_dataset_dir() for that.
  • Returns the general data directory based on the user’s home folder.
    Basically, tries to resolve the folder ~/.local/share/brane/data.
    Note that this does not mean that this directory exists.
  • Edited: Now returns UtilErrors.
  • Gets the directory where we store the instance definition for the given instance.
  • Gets the directory where we store instance definitions.
  • Edited: Now returning UtilErrors.
  • Edited: Changed to return UtilErrors.
  • Returns an equivalent string to the given one, except that the first letter is capitalized.