Skip to content

fix: resolve executable-named CLI scopes implicitly without argv rewriting - #10

Merged
dermatthes merged 1 commit into
mainfrom
fix/implicit-executable-cli-scope-20261104
Nov 4, 2026
Merged

dermatthes merged 1 commit into
mainfrom
fix/implicit-executable-cli-scope-20261104

Conversation

@dermatthes

Copy link
Copy Markdown
Contributor

Problem

CliApplication::run($argv) uses $argv[0] only as help text. An executable named shiller registering #[CliScope('shiller')] previously required synthetic invocation run(['shiller', 'shiller', ...]) to invoke shiller init, and had to special-case another scope edit.

Change

  • Normalize the executable path to its basename in CliApplication::run().
  • In T_CommandSet, dispatch an unresolved top-level action through a scope named like the executable, without mutating or rewriting the caller's arguments. Explicit top-level groups still take precedence.
  • Flatten just that executable-named scope into the top-level help. Nested and independent scopes still appear as groups.
  • Preserve explicit legacy tool tool init calls.
  • Add PHPSpec tests for executable paths, implicit tool init, independent tool edit create and tool edit resolve, help behavior, and unrelated scopes.
  • Document standard $app->run($argv) usage.

No Shiller-specific names, commands, or special cases are introduced.

Downstream: leuffen/leuffen-shiller-lib PR #29 will remove its manual argv rewriting once this library change is available on dev-main.

@dermatthes
dermatthes merged commit 8dfaffb into main Nov 4, 2026
2 checks passed
@dermatthes
dermatthes deleted the fix/implicit-executable-cli-scope-20261104 branch November 4, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant