Skip to content

factory

appimage_updater.commands.factory

Command factory for creating command instances.

CommandFactory

Factory for creating command instances from CLI parameters.

create_add_command(name=None, url=None, download_dir=None, create_dir=False, yes=False, no=False, config_file=None, config_dir=None, rotation=None, retain=5, symlink=None, prerelease=None, basename=None, checksum=None, checksum_algorithm='sha256', checksum_pattern='', checksum_required=None, pattern=None, version_pattern=None, direct=None, auto_subdir=None, verbose=False, dry_run=False, interactive=False, examples=False, debug=False, output_format=None) staticmethod

Create an AddCommand instance.

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_add_command(
    name: str | None = None,
    url: str | None = None,
    download_dir: str | None = None,
    create_dir: bool = False,
    yes: bool = False,
    no: bool = False,
    config_file: Path | None = None,
    config_dir: Path | None = None,
    rotation: bool | None = None,
    retain: int = 5,
    symlink: str | None = None,
    prerelease: bool | None = None,
    basename: str | None = None,
    checksum: bool | None = None,
    checksum_algorithm: str = "sha256",
    checksum_pattern: str = "",
    checksum_required: bool | None = None,
    pattern: str | None = None,
    version_pattern: str | None = None,
    direct: bool | None = None,
    auto_subdir: bool | None = None,
    verbose: bool = False,
    dry_run: bool = False,
    interactive: bool = False,
    examples: bool = False,
    debug: bool = False,
    output_format: Any = None,
) -> AddCommand:
    """Create an AddCommand instance."""
    params = AddParams(
        name=name,
        url=url,
        download_dir=download_dir,
        create_dir=create_dir,
        yes=yes,
        no=no,
        config_file=config_file,
        config_dir=config_dir,
        rotation=rotation,
        retain=retain,
        symlink=symlink,
        prerelease=prerelease,
        basename=basename,
        checksum=checksum,
        checksum_algorithm=checksum_algorithm,
        checksum_pattern=checksum_pattern,
        checksum_required=checksum_required,
        pattern=pattern,
        version_pattern=version_pattern,
        direct=direct,
        auto_subdir=auto_subdir,
        verbose=verbose,
        dry_run=dry_run,
        interactive=interactive,
        examples=examples,
        debug=debug,
        output_format=output_format,
    )
    return AddCommand(params)

create_check_command_with_instrumentation(app_names=None, config_file=None, config_dir=None, dry_run=False, yes=False, no=False, no_interactive=False, verbose=False, debug=False, instrumentation=None, output_format='rich') staticmethod

Create a CheckCommand instance using InstrumentationParams.

This is a convenience method that reduces parameter list complexity by accepting an InstrumentationParams object instead of individual instrumentation parameters.

Parameters:

Name Type Description Default
app_names list[str] | None

List of application names to check

None
config_file Path | None

Path to configuration file

None
config_dir Path | None

Path to configuration directory

None
dry_run bool

Whether to run in dry-run mode

False
yes bool

Automatically answer yes to prompts

False
no bool

Automatically answer no to prompts

False
no_interactive bool

Disable interactive prompts

False
verbose bool

Enable verbose output

False
debug bool

Enable debug output

False
instrumentation InstrumentationParams | None

Instrumentation parameters object

None
output_format str

Output format (rich, plain, json, html)

'rich'

Returns:

Type Description
CheckCommand

CheckCommand instance

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_check_command_with_instrumentation(
    app_names: list[str] | None = None,
    config_file: Path | None = None,
    config_dir: Path | None = None,
    dry_run: bool = False,
    yes: bool = False,
    no: bool = False,
    no_interactive: bool = False,
    verbose: bool = False,
    debug: bool = False,
    instrumentation: InstrumentationParams | None = None,
    output_format: str = "rich",
) -> CheckCommand:
    """Create a CheckCommand instance using InstrumentationParams.

    This is a convenience method that reduces parameter list complexity
    by accepting an InstrumentationParams object instead of individual
    instrumentation parameters.

    Args:
        app_names: List of application names to check
        config_file: Path to configuration file
        config_dir: Path to configuration directory
        dry_run: Whether to run in dry-run mode
        yes: Automatically answer yes to prompts
        no: Automatically answer no to prompts
        no_interactive: Disable interactive prompts
        verbose: Enable verbose output
        debug: Enable debug output
        instrumentation: Instrumentation parameters object
        output_format: Output format (rich, plain, json, html)

    Returns:
        CheckCommand instance
    """
    instr = instrumentation or InstrumentationParams()
    params = CheckParams(
        app_names=app_names,
        config_file=config_file,
        config_dir=config_dir,
        dry_run=dry_run,
        yes=yes,
        no=no,
        no_interactive=no_interactive,
        verbose=verbose,
        debug=debug,
        info=instr.info,
        instrument_http=instr.instrument_http,
        http_stack_depth=instr.http_stack_depth,
        http_track_headers=instr.http_track_headers,
        trace=instr.trace,
        output_format=output_format,
    )
    return CheckCommand(params)

create_config_command(action, setting='', value='', app_name='', config_file=None, config_dir=None, debug=False, output_format=None) staticmethod

Create a ConfigCommand instance.

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_config_command(
    action: str,
    setting: str = "",
    value: str = "",
    app_name: str = "",
    config_file: Path | None = None,
    config_dir: Path | None = None,
    debug: bool = False,
    output_format: Any = None,
) -> ConfigCommand:
    """Create a ConfigCommand instance."""
    params = ConfigParams(
        action=action,
        setting=setting,
        value=value,
        app_name=app_name,
        config_file=config_file,
        config_dir=config_dir,
        debug=debug,
        output_format=output_format,
    )
    return ConfigCommand(params)

create_edit_command(app_names=None, config_file=None, config_dir=None, url=None, download_dir=None, basename=None, pattern=None, version_pattern=None, rotation=None, retain_count=None, symlink_path=None, prerelease=None, checksum=None, checksum_algorithm=None, checksum_pattern=None, checksum_required=None, direct=None, enable=None, force=False, create_dir=False, yes=False, no=False, auto_subdir=None, verbose=False, dry_run=False, debug=False, output_format=None) staticmethod

Create an EditCommand instance.

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_edit_command(
    app_names: list[str] | None = None,
    config_file: Path | None = None,
    config_dir: Path | None = None,
    url: str | None = None,
    download_dir: str | None = None,
    basename: str | None = None,
    pattern: str | None = None,
    version_pattern: str | None = None,
    rotation: bool | None = None,
    retain_count: int | None = None,
    symlink_path: str | None = None,
    prerelease: bool | None = None,
    checksum: bool | None = None,
    checksum_algorithm: str | None = None,
    checksum_pattern: str | None = None,
    checksum_required: bool | None = None,
    direct: bool | None = None,
    enable: bool | None = None,
    force: bool = False,
    create_dir: bool = False,
    yes: bool = False,
    no: bool = False,
    auto_subdir: bool | None = None,
    verbose: bool = False,
    dry_run: bool = False,
    debug: bool = False,
    output_format: Any = None,
) -> EditCommand:
    """Create an EditCommand instance."""
    params = EditParams(
        app_names=app_names,
        config_file=config_file,
        config_dir=config_dir,
        url=url,
        download_dir=download_dir,
        basename=basename,
        pattern=pattern,
        version_pattern=version_pattern,
        rotation=rotation,
        retain_count=retain_count,
        symlink_path=symlink_path,
        prerelease=prerelease,
        checksum=checksum,
        checksum_algorithm=checksum_algorithm,
        checksum_pattern=checksum_pattern,
        checksum_required=checksum_required,
        direct=direct,
        enable=enable,
        force=force,
        create_dir=create_dir,
        yes=yes,
        no=no,
        auto_subdir=auto_subdir,
        verbose=verbose,
        dry_run=dry_run,
        debug=debug,
        output_format=output_format,
    )
    return EditCommand(params)

create_list_command(config_file=None, config_dir=None, debug=False, output_format=None) staticmethod

Create a ListCommand instance.

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_list_command(
    config_file: Path | None = None,
    config_dir: Path | None = None,
    debug: bool = False,
    output_format: Any = None,
) -> ListCommand:
    """Create a ListCommand instance."""
    params = ListParams(
        config_file=config_file,
        config_dir=config_dir,
        debug=debug,
        output_format=output_format,
    )
    return ListCommand(params)

create_remove_command(app_names=None, config_file=None, config_dir=None, yes=False, no=False, verbose=False, debug=False, output_format=None) staticmethod

Create a RemoveCommand instance.

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_remove_command(
    app_names: list[str] | None = None,
    config_file: Path | None = None,
    config_dir: Path | None = None,
    yes: bool = False,
    no: bool = False,
    verbose: bool = False,
    debug: bool = False,
    output_format: Any = None,
) -> RemoveCommand:
    """Create a RemoveCommand instance."""
    params = RemoveParams(
        app_names=app_names,
        config_file=config_file,
        config_dir=config_dir,
        yes=yes,
        no=no,
        verbose=verbose,
        debug=debug,
        output_format=output_format,
    )
    return RemoveCommand(params)

create_repository_command_with_instrumentation(app_names=None, config_file=None, config_dir=None, assets=False, limit=10, dry_run=False, instrumentation=None, verbose=False, debug=False, output_format=None) staticmethod

Create a RepositoryCommand instance using InstrumentationParams.

This is a convenience method that reduces parameter list complexity by accepting an InstrumentationParams object instead of individual instrumentation parameters.

Parameters:

Name Type Description Default
app_names list[str] | None

List of application names

None
config_file Path | None

Path to configuration file

None
config_dir Path | None

Path to configuration directory

None
assets bool

Whether to show assets

False
limit int

Maximum number of releases to fetch

10
dry_run bool

Whether to run in dry-run mode

False
instrumentation InstrumentationParams | None

Instrumentation parameters object

None
verbose bool

Enable verbose output

False
debug bool

Enable debug output

False
output_format Any

Output format

None

Returns:

Type Description
RepositoryCommand

RepositoryCommand instance

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_repository_command_with_instrumentation(
    app_names: list[str] | None = None,
    config_file: Path | None = None,
    config_dir: Path | None = None,
    assets: bool = False,
    limit: int = 10,
    dry_run: bool = False,
    instrumentation: InstrumentationParams | None = None,
    verbose: bool = False,
    debug: bool = False,
    output_format: Any = None,
) -> RepositoryCommand:
    """Create a RepositoryCommand instance using InstrumentationParams.

    This is a convenience method that reduces parameter list complexity
    by accepting an InstrumentationParams object instead of individual
    instrumentation parameters.

    Args:
        app_names: List of application names
        config_file: Path to configuration file
        config_dir: Path to configuration directory
        assets: Whether to show assets
        limit: Maximum number of releases to fetch
        dry_run: Whether to run in dry-run mode
        instrumentation: Instrumentation parameters object
        verbose: Enable verbose output
        debug: Enable debug output
        output_format: Output format

    Returns:
        RepositoryCommand instance
    """
    instr = instrumentation or InstrumentationParams()
    params = RepositoryParams(
        app_names=app_names,
        config_file=config_file,
        config_dir=config_dir,
        assets=assets,
        limit=limit,
        dry_run=dry_run,
        instrument_http=instr.instrument_http,
        http_stack_depth=instr.http_stack_depth,
        http_track_headers=instr.http_track_headers,
        trace=instr.trace,
        verbose=verbose,
        debug=debug,
        output_format=output_format,
    )
    return RepositoryCommand(params)

create_show_command(app_names=None, add_command=False, config_file=None, config_dir=None, verbose=False, debug=False, output_format=None) staticmethod

Create a ShowCommand instance.

Source code in src/appimage_updater/commands/factory.py
@staticmethod
def create_show_command(
    app_names: list[str] | None = None,
    add_command: bool = False,
    config_file: Path | None = None,
    config_dir: Path | None = None,
    verbose: bool = False,
    debug: bool = False,
    output_format: Any = None,
) -> ShowCommand:
    """Create a ShowCommand instance."""
    params = ShowParams(
        app_names=app_names,
        add_command=add_command,
        config_file=config_file,
        config_dir=config_dir,
        verbose=verbose,
        debug=debug,
        output_format=output_format,
    )
    return ShowCommand(params)