Webwright icon indicating copy to clipboard operation
Webwright copied to clipboard

feat: add list-configs subcommand to CLI

Open nuthalapativarun opened this issue 6 months ago • 1 comments

Problem

New users have no way to discover which config files are available without browsing the source tree. The -c flag requires knowing a config filename in advance, creating friction for first-time users trying to switch backends (e.g. from OpenAI to Anthropic).

Fix

Add a list-configs subcommand to the Typer app that prints the names of all .yaml files in the built-in config directory. Update the README flags table to document the new command.

Changes

  • src/webwright/run/cli.py — added list_configs() command decorated with @app.command("list-configs"); imports builtin_config_dir from webwright.config
  • README.md — added list-configs row to the flags table with usage example

Not affected

  • The existing main command — not touched; no flags changed
  • webwright/config/__init__.py — builtin_config_dir was already exported; no changes needed

nuthalapativarun avatar May 29 '26 06:05 nuthalapativarun

Fixed in fda3bcd.

Converted main from @app.command() to @app.callback(invoke_without_command=True). When Typer sees a callback with this flag, it invokes the callback for every execution but only runs a subcommand if one is explicitly named — so the existing python -m webwright.run.cli -c base.yaml -t "..." form continues to work unchanged, while list-configs is still reachable as an explicit subcommand.

Changed --task from required (...) to optional (None) in the callback signature (required only when no subcommand is present), and added an early return when ctx.invoked_subcommand is not None so the callback is a no-op during list-configs. No changes needed to the README Quick Start or run_command.sh.

nuthalapativarun avatar Jun 02 '26 15:06 nuthalapativarun