Skip to content

Docs: Shell.arguments follows $@ semantics, not CommandLine.arguments#18

Merged
odrobnik merged 1 commit into
mainfrom
doc/arguments-positional-semantics
Jun 11, 2026
Merged

Docs: Shell.arguments follows $@ semantics, not CommandLine.arguments#18
odrobnik merged 1 commit into
mainfrom
doc/arguments-positional-semantics

Conversation

@odrobnik

Copy link
Copy Markdown
Contributor

Doc-only. Shell.arguments claimed to mirror CommandLine.arguments semantics, but CommandLine.arguments[0] is the binary path while positionalParameters[0] is $1 (Shell.processDefault builds it with argv.dropFirst()). That overstatement led a standalone entry point to dropFirst() again and ship an argv-deaf binary — Cocoanetics/SwiftPorts#69 (fixed there by Cocoanetics/SwiftPorts#74, which suggested this clarification).

The doc now states the $@ contract explicitly: program name not included, arguments[0] is the first real argument, and the fall-through is the host process arguments minus argv[0].

🤖 Generated with Claude Code

The doc claimed 'Mirrors CommandLine.arguments semantics', but
CommandLine.arguments[0] is the binary path while
positionalParameters[0] is $1 — Shell.processDefault already strips
argv[0]. That mismatch produced a double-drop in SwiftPorts' gh
standalone entry (Cocoanetics/SwiftPorts#69, argv-deaf binary).
State the $@ contract explicitly and warn about the dropFirst habit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@odrobnik odrobnik merged commit 27b7961 into main Jun 11, 2026
6 checks passed
@odrobnik odrobnik deleted the doc/arguments-positional-semantics branch June 11, 2026 21:31
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