-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add a fallback to alternate shards commands #202
Add a fallback to alternate shards commands #202
Conversation
647499b
to
0ce9996
Compare
Any use cases? |
In short, extensibility. Sometimes subcommands don't belong in the core shards project, but would be nice to have and run under the same shards umbrella. This allows the community to create and maintain subcommands without needing approval from the maintainers of shards itself. For example, rust has implemented a similar scheme in cargo (https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands). Some good subcommand examples from this list include:
Additionally, I would argue that any of these are valid use cases:
|
I'm not all too sure of this. If your tool is separate from shards why not give it a separate command instead of stuffing it under the shards command? I imagine it's just confusing to users what's part of shards and what is not. |
Well, That being said |
This PR's implementation should allow seamless passthrough of arguments. |
The benefit of having |
I'll consider this for post v0.8.0 release. |
We're already post v0.8.0, just a reminder ;) |
@Willamin Are you willing to continue working on this PR? |
@Sija Yes, sorry for the delay, I'll implement the suggestions from @straight-shoota. 😄 |
cfd457c
to
6356c11
Compare
I've never actually seen a |
yeah. Two good examples are https://github.com/tummychow/git-absorb and |
And a big collection of extra commands: https://github.com/tj/git-extras |
Shards will attempt to exec 'shards-#{subcommand}' if the subcommand doesn't exist in core shards. If no executable exists in the user's path, shards will fall back to 'shards help'.
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
5f025c6
to
c54ee91
Compare
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Thank you @Willamin |
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
This allows additional functionality to be added to the shards command in a similar way extra commands are added to
git
. Basically, if the shards command isn't found in shards itself, it will runshards-#{command}
, passing STDIO through. If there is no executable that matches the attempted command, the regular shards usage message is shown.