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

Add a forc plugins command for listing all plugins #1199

Merged
merged 2 commits into from
Apr 11, 2022

Conversation

mitchmindtree
Copy link
Contributor

Closes #1198.

Lists the full path to every forc-* plugin discovered under the user's
PATH.

For example:

[mindtree@minddesk:~]$ forc plugins
/home/mindtree/.cargo/bin/forc-fmt
/home/mindtree/.cargo/bin/forc-explore
/home/mindtree/.cargo/bin/forc-lsp

We could potentially add flags to this command in the future for:

  • only emitting executable names (not full paths)
  • printing versions and descriptions in a table
  • outputting via JSON or TOML for easier machine digestion.

For now, this PR just aims to add initial support.

The logic included in this should make it easier to include available
plugin commands in a future forc --list command too (ala #702).

Copy link
Contributor

@eureka-cpu eureka-cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! only thing I can think of for future reference is that we're just checking that the file exists and starts with forc-, should we not create a struct with the possible plugins and use that to match instead? or is this method of checking enough?

@sezna
Copy link
Contributor

sezna commented Apr 8, 2022

should we not create a struct with the possible plugins and use that to match instead?

We won't actually ever know what all the plugins are. The idea is that this is user-extensible, so users can write their own forc plugins 👍🏻

Closes #1198.

Lists the full path to every `forc-*` plugin discovered under the user's
`PATH`.

For example:

```sh
[mindtree@minddesk:~]$ forc plugins
/home/mindtree/.cargo/bin/forc-fmt
/home/mindtree/.cargo/bin/forc-explore
/home/mindtree/.cargo/bin/forc-lsp
```

We could potentially add flags to this command in the future for:

- only emitting executable names (not full paths)
- printing versions and descriptions in a table
- outputting via JSON or TOML for easier machine digestion.

For now, this PR just aims to add initial support.

The logic included in this should make it easier to include available
plugin commands in a future `forc --list` command too (ala #702).
@mitchmindtree mitchmindtree force-pushed the mitchmindtree/forc-list-plugins branch from 9645b3e to 039cf16 Compare April 9, 2022 02:27
@adlerjohn
Copy link
Contributor

We could potentially add flags to this command in the future for:

Can you file some good first issues for those?

forc/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forc
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add a forc plugins command that lists all forc-* plugins discovered on PATH
4 participants