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

Perhaps consider renaming it to cargo-hack? #7

Closed
asdf8dfafjk opened this issue Nov 12, 2021 · 7 comments
Closed

Perhaps consider renaming it to cargo-hack? #7

asdf8dfafjk opened this issue Nov 12, 2021 · 7 comments

Comments

@asdf8dfafjk
Copy link

Seeing as it deals with cargo more than rust and the usage of the term cargo is even encouraged for such things? This would hopefully let me just issue cargo hack and get done with things :). Small thing but I think it might matter

@nakabonne
Copy link
Owner

@asdf8dfafjk Hey, good point. I was looking into making this tool a sub-command of cargo, but I'm not familiar with it so I've been putting it off for a long time.

@asdf8dfafjk
Copy link
Author

So yeah I just tried it and looks like renaming it cargo-hack alone won't be enough. So looks like our goal is same but the renaming step alone won't achieve it and you'll need to also modify the positional argument handling from the command line.
Here's a sample command line session. I have verified that the error language is from your tool, thus the cargo hack part indeed calls cargo-hack. Ideally what is now rhack edit <crate name> would become cargo hack <crate name> so effectively you could ignore $2 and continue looking at $3.

image

@asdf8dfafjk
Copy link
Author

I retract what I've said above. Give me a few minutes.

@asdf8dfafjk
Copy link
Author

So this is the page for subcommands: https://doc.rust-lang.org/cargo/reference/external-tools.html?highlight=subcommand#custom-subcommands

Basically if you say cargo hack chrono, then $1 is cargo-hack, $2 is hack and $3 is chrono. If you say cargo help hack, then $1 is cargo-hack, $2 is hack, $3 is --help`.

I'd propose the following alternatives for the current "sub-sub" commands:

rhack edit chrono -> cargo hack chrono
rhack --help             -> cargo help hack 
rhack help               -> cargo help hack
rhack undo chrono -> cargo hack chrono --undo

@simonsan
Copy link

cargo-hack is already existing, cargo-rhack would be free.

https://crates.io/crates/cargo-hack

@simonsan
Copy link

simonsan commented May 20, 2023

Fixed it, so it runs as a cargo subcommand and pushed it to https://crates.io/crates/cargo-rhack and invited @nakabonne as an owner (so they can update as they like, when they read this, took it just as a name reservation, so nobody comes now to take it). 👍🏽

Fixed in #10 (closed due to branch rename)
Fixed in #11

@asdf8dfafjk
Copy link
Author

Awesome.

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

3 participants