swift package init
does not handle --package-path
argument if it's not the first command line argument
#8418
Labels
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
Running
swift package init --type <type> --package-path to-be-deleted/foo
fails witherror: Unknown option '--package-path'
Actually providing
--package-path <path>
after anyinit
argument caused this error:swift package init --type <type> --package-path swift-package/$RANDOM
swift package init --enable-xctest --package-path swift-package/$RANDOM
swift package init --enable-swift-testing --package-path swift-package/$RANDOM
swift package init --name thing --package-path swift-package/$RANDOM
To workaround this, we need to place the
--package-path <path>
before the--type <type>
, and the command then work.Looking at the
swift package init --help
, it does not contains the--package-path
option.Expected behavior
the
swift package init
should either:--package-path <path>
command line option, no matter the order it is provided--package-path <path>
should be provided beforeinit
. e.g.:swift package --package-path <path> init
The current behaviour is confusing and not ideal.
Actual behavior
Steps to reproduce
Run the following, tested on
zsh
Swift Package Manager version/commit hash
Using swift main-snapshot-2025-03-25
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: