Skip to content

CLI Bug: Status Command Requires Global --config Flag #3

Description

@tosfos

The autouam status command fails with "Configuration file is required for this command" when using autouam status --config /path/to/config.yaml, even though the global autouam -c /path/to/config.yaml status works.

Current Behavior

# This works:
autouam -c /etc/autouam/config.yaml status

# This fails with "Error: No such option: --config":
autouam status --config /etc/autouam/config.yaml

Expected Behavior

# This should work (consistent with other CLI tools):
autouam status --config /etc/autouam/config.yaml

Root Cause

The CLI is designed such that:

  1. The global autouam command accepts -c, --config PATH
  2. Individual commands like status require obj.settings to be populated
  3. Individual commands do NOT accept their own --config option
  4. This forces users to use the global -c flag before the command

Impact

  • Poor UX: Inconsistent with user expectations and common CLI patterns
  • Container Unfriendly: Difficult to use in containerized environments
  • Confusing: Users don't understand why --config isn't accepted
  • Inflexible: Can't specify config per command

Proposed Solution

Add --config option to individual commands that require configuration:

@main.command()
@click.option("--config", "-c", type=click.Path(exists=True), help="Configuration file path")
@click.pass_context
def status(ctx: click.Context, config: str) -> None:
    """Show current status."""
    if config:
        obj.settings = Settings.from_file(Path(config))
    elif not obj.settings:
        print_error("Configuration file is required for this command")
        sys.exit(1)
    # ... rest of function

Benefits

  • User-friendly: Follows common CLI patterns (kubectl --kubeconfig, docker --config)
  • Container-friendly: Works well in Docker environments with mounted configs
  • Explicit: Users know exactly which config is being used
  • Backward compatible: Global -c flag still works
  • Consistent: All config-requiring commands work the same way

Affected Commands

At minimum: status, enable, disable, check (any command requiring API access)

Environment

  • AutoUAM version: 1.0.0a7
  • Deployment: Docker container
  • Configuration: YAML config file

Additional Context

This issue was discovered during Docker container deployment where users expect to be able to specify config files per command rather than relying on global flags. The current design makes container usage unnecessarily complex.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions