Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbt new fails to parse arguments correctly on Windows #7507

Open
ptrdom opened this issue Mar 4, 2024 · 3 comments
Open

sbt new fails to parse arguments correctly on Windows #7507

ptrdom opened this issue Mar 4, 2024 · 3 comments
Labels

Comments

@ptrdom
Copy link
Contributor

ptrdom commented Mar 4, 2024

steps

Replicated on sbt 1.9.9, running Windows Terminal (PowerShell).

  1. Open command line on Windows
  2. Run sbt new foundweekends/giter8.g8 --name=example.g8 --giter8_version=0.16.2 --sbt_version=1.9.9

problem

Command does not run successfully, error is throw:

Error: Unknown option --name
Error: Unknown argument 'example.g8'
Error: Unknown option --giter8_version
Error: Unknown argument '0.16.2'
Error: Unknown option --sbt_version
Error: Unknown argument '1.9.8'
Try --help for more information.

Command does work on Linux, tested on WSL (Ubuntu).

expectation

sbt project should be created from the template successfully with arguments passed to the template.

notes

After experimenting with variations of command, one version I found to work was sbt new foundweekends/giter8.g8 "--name=example.g8 " "--giter8_version=0.16.2 " "--sbt_version=1.9.9 " - arguments must be enclosed in quotes and must be terminated by a space.
One strange variation was that enclosing all arguments in quotes - sbt new foundweekends/giter8.g8 "--name=example.g8 --giter8_version=0.16.2 --sbt_version=1.9.9" - created the sbt project, but with only the name argument set to example.g8 --giter8_version=0.16.2 --sbt_version=1.9.9, meaning that sbt project's directory would end up containing the remaining part of argument string.
This does not seem intentional, likely a bug in parser module.

@ptrdom ptrdom added the Bug label Mar 4, 2024
@ptrdom
Copy link
Contributor Author

ptrdom commented Mar 4, 2024

Could also be a problem with launcher - it does extract the arguments that are then passed to sbt.

@eed3si9n
Copy link
Member

eed3si9n commented Mar 4, 2024

See also #2695. On Windows batch, equal sign = I think is treated as whitespace.

@ptrdom
Copy link
Contributor Author

ptrdom commented Mar 4, 2024

So apparently = is a default delimiter in batch scripts, workarounds for this issue seem to be present for certain types of arguments in launcher script already.

I am starting to think that it would be better to just start out fresh with a v2 cross-platform launcher script/app instead of keeping on patching these issues separately. Similar to how in g8 project the launcher script is just a Java app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants