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

Init transparently (was: Rustlings command should mirror cargo command as far as possible) #2218

Open
daniel-pfeiffer opened this issue Mar 15, 2025 · 0 comments

Comments

@daniel-pfeiffer
Copy link

daniel-pfeiffer commented Mar 15, 2025

New Proposal

Thinking more about this, why have an annoying extra step to init in the first place? The user experience would be smoother, if it would just start!

There would be 3 cases to handle:

  • already in directory, just go. Like: cargo run
  • directory exists as sub-directory, cd there internally and go. Like: cargo -C rustlings run
  • directory not found near here, init it transparently, cd there internally and go. Like: cargo new rustlings; cargo -C rustlings run

Original Proposal

Cargo has two near identical commands new and init. They both do exactly the same thing. (But apparently implemented twice, because the message differs a bit.) Additionally only init has a 2nd behaviour, when not given an argument.

Confusingly rustlings init is different to that! Since backwards compatibility is hardly important, I suggest to align with cargo like this:

  • rustlings init (re-)initialises the current directory (to avoid pain for people already used to old behaviour, maybe only if it is empty or contains Cargo.toml)
  • rustlings new creates the directory rustlings
  • rustlings init <NAME> and rustlings new <NAME> create a new directory <NAME>
@daniel-pfeiffer daniel-pfeiffer changed the title Rustlings command should mirror cargo command as far as possible Init transparently (was: Rustlings command should mirror cargo command as far as possible) Mar 16, 2025
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

No branches or pull requests

1 participant