Homebrew-file module index

class brew_file.BrewFile(opt: dict[str, ~typing.Any] = <factory>)

Main class of Brew-file.

class DryrunBanner(brewfile: BrewFile)

Dryrun banner context manager.

ask_yn(question: str) bool

Ask yes/no question.

cat_brewfile() None

Cat brewfiles.

check_brew_cmd() bool

Check Homebrew.

check_cask() None

Check applications for Cask.

check_cmd(flag: str, cmd: str, formula: str, install: bool = False) Literal[-2, -1, 0, 1]

Check command is installed or not.

check_cursor_cmd(install: bool = False) Literal[-2, -1, 0, 1]

Check cursor is installed or not.

check_docker_running() Literal[-2, -1, 0, 1]

Check if Docker is running.

check_github_repo() None

Check GitHub repository.

check_input_file() None

Check input file.

check_mas_cmd(install: bool = False) Literal[-2, -1, 0, 1]

Check mas is installed or not.

check_repo() None

Check input file for Git repository.

check_vscode_cmd(install: bool = False) Literal[-2, -1, 0, 1]

Check code (for VSCode) is installed or not.

check_whalebrew_cmd(install: bool = False) Literal[-2, -1, 0, 1]

Check whalebrew is installed or not.

clean_list() None

Remove duplications between brewinfo.list to extra files’ input.

clean_non_request() None

Clean up non requested packages.

cleanup(delete_cache: bool = True) None

Clean up.

edit_brewfile() None

Edit brewfiles.

execute() None

Execute.

get_files(is_print: bool = False, all_files: bool = False, error_no_file: bool = True) list[Path]

Get Brewfiles.

get_installed_packages(force_appstore_list: bool = False) None

Get Installed Package List.

initialize(check: bool = True, check_input: bool = True, debug_out: bool = False) bool

Initialize Brewfile.

parse_env_opts(env_var: str, base_opts: dict[str, Any] | None = None) dict[str, str]

Return a dictionary parsed from an environment variable.

repo_file() Path

Return the Brewfile path for the repository.

repomgr(cmd: str = 'pull') None

Manage repository.

set_args(**kw: str) None

Set arguments.

set_brewfile_local() None

Set Brewfile to local file.

set_brewfile_repo() bool

Set Brewfile repository.

class brew_file.BrewHelper(opt: dict[str, ~typing.Any] = <factory>)

Helper functions for BrewFile.

get_all_info() dict[str, dict[str, Any]]

Get info of all available brew package.

get_full_name(package: str) str

Get full name (user/tap/package) of a package.

get_info() dict[str, Any]

Get info of installed brew package.

get_installed(package: str) dict[str, Any]

Get installed version of brew package.

get_option(package: str) str

Get install options from brew info.

proc(cmd: str | list[str], print_cmd: bool = True, print_out: bool = True, exit_on_err: bool = True, separate_err: bool = False, print_err: bool = True, env: dict[str, str] | None = None, cwd: str | Path | None = None, dryrun: bool = False) tuple[int, list[str]]

Get process output.

class brew_file.BrewInfo(helper: ~brew_file.BrewHelper, file: ~pathlib.Path = <factory>)

Homebrew information storage.

packout(pack: str) str

Get package name for output.

exception brew_file.CmdError(message: str, return_code: int)

Exception at command execution.

class brew_file.LogFormatter

Formatter to add color to log messages.

format(record: LogRecord) str

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

class brew_file.OpenWrapper(name: str, mode: Literal['w', 'r', 'a'] = 'w')

Wrapper function to open a file even if it doesn’t exist.

class brew_file.ProcParams

Parameters for BrewHelper.proc().

class brew_file.StrRe(var: str)

Str wrapper to use regex especially for match-case.