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

Feature Request: Enable Third Party Subcommands #15757

Open
aunyks opened this issue Sep 4, 2022 · 5 comments
Open

Feature Request: Enable Third Party Subcommands #15757

aunyks opened this issue Sep 4, 2022 · 5 comments
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)

Comments

@aunyks
Copy link

aunyks commented Sep 4, 2022

Hi! I’d love to have the ability to create and install third party subcommands.

I’m imagining functionality like Git or Cargo, where if I have an executable deno-foo in my PATH, then running deno foo —my —flags will invoke deno-foo with —my —flags as arguments.

Does something like this already exist within Deno? If not, I’d love to help implement.

@aunyks aunyks changed the title Enable Third Party Subcommands Feature Request: Enable Third Party Subcommands Sep 4, 2022
@aunyks
Copy link
Author

aunyks commented Sep 4, 2022

@littledivy Is this request formatted properly?

@littledivy littledivy added cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) labels Sep 4, 2022
@bartlomieju
Copy link
Member

While this is an interesting feature request, there are many questions to answer on how this could be implemented.

@aunyks could you provide some prior art how this feature is implemented in cargo?

@aunyks
Copy link
Author

aunyks commented Sep 4, 2022

@bartlomieju Of course. Here’s some Cargo documentation on custom subcommands: https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands. I couldn’t find official Git documentation for the same feature, but this article conveys the idea: https://www.atlassian.com/git/articles/extending-git.

@dsherret
Copy link
Member

dsherret commented Sep 4, 2022

I think deno install covers the usecase of global commands? We also have deno task for repo-specific commands.

@kidonng
Copy link
Contributor

kidonng commented Sep 5, 2022

If this is only for yourself, it shouldn't be too hard to write a shell function. Fish example:

function deno --argument-names command
    if command --query deno-$command
        deno-$command $argv[2..]
    else
        command deno $argv
    end
end

If you are looking for distribution, deno install is more suitable, as mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

5 participants