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 forc --list #702

Closed
Tracked by #482
adlerjohn opened this issue Jan 25, 2022 · 10 comments
Closed
Tracked by #482

Add forc --list #702

adlerjohn opened this issue Jan 25, 2022 · 10 comments
Labels
enhancement New feature or request forc good first issue Good for newcomers P: low

Comments

@adlerjohn
Copy link
Contributor

adlerjohn commented Jan 25, 2022

Lists commands, similar to cargo --list

@adlerjohn adlerjohn added enhancement New feature or request forc good first issue Good for newcomers labels Jan 25, 2022
@adlerjohn
Copy link
Contributor Author

@ControlCplusControlV has requested to work on this, ref: #482 (comment)

@adlerjohn adlerjohn changed the title Add forc --list that lists commands, similar to cargo --list Add forc --list Jan 25, 2022
@adlerjohn
Copy link
Contributor Author

This is no longer necessary to implementation completions, though it may be independently useful.

mitchmindtree added a commit that referenced this issue Apr 8, 2022
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 added a commit that referenced this issue Apr 9, 2022
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
Copy link
Contributor

I think this would still be quite useful for downstream tooling. E.g. the forc-documenter could use this to generate all the modules (rather than having to list them in the index.md).

We should also consider including available plugin commands in the output (I think cargo --list does this) so that downstream tools can process these altogether. Perhaps a flag could be provided for omitting plugins from the output.

mitchmindtree added a commit that referenced this issue Apr 11, 2022
* Add a `forc plugins` command for listing all 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).

* Specify major.minor for forc's walkdir dependency
@ra0x3 ra0x3 self-assigned this Apr 28, 2022
@ra0x3 ra0x3 linked a pull request Apr 29, 2022 that will close this issue
1 task
@ra0x3 ra0x3 mentioned this issue Apr 29, 2022
1 task
@ra0x3 ra0x3 removed a link to a pull request Apr 29, 2022
1 task
@ra0x3 ra0x3 removed their assignment May 4, 2022
@ra0x3
Copy link
Contributor

ra0x3 commented May 4, 2022

@mitchmindtree
Copy link
Contributor

Labelled as low-priority as forc-documenter will use distinct forc --help and forc plugins commands for documenting each anyway, and this isn't really blocking anything, but will still be useful command to have in the future.

@eightfilms
Copy link
Contributor

eightfilms commented Sep 8, 2022

Would it be a good time to re-prioritise this issue? I think as we start to move plugins into their own repos (#2608, #2609) we might get more questions of "why is XYZ feature not listed under forc help?", which we are already starting to get now, since forc deploy and forc run have been moved into the forc-client plugin. We also have forc-wallet which already does not show up as a command in core forc.

cargo prompts you to 'see all commands with --list', which I think we can follow as a guide here perhaps.

Screenshot 2022-09-08 at 5 24 34 PM

@mitchmindtree
Copy link
Contributor

@bingcicle we do have the forc plugins command, e.g.

[mindtree@minddesk:~/programming/nix/fuel]$ forc plugins
Installed Plugins:
forc-deploy
forc-run
forc-fmt
forc-explore
forc-wallet
forc-lsp

[mindtree@minddesk:~/programming/nix/fuel]$ forc plugins --describe
Installed Plugins:
  forc-deploy           No description found for this plugin.
  forc-run              Run script project. Crafts a script transaction then sends it to a running node
  forc-fmt              Forc plugin for running the Sway code formatter.
  forc-explore          Forc plugin for running the Fuel Block Explorer.
  forc-wallet           A forc plugin for generating or importing wallets using BIP39 phrases.
  forc-lsp              Forc plugin for the Sway LSP (Language Server Protocol) implementation.

[mindtree@minddesk:~/programming/nix/fuel]$ forc plugins --paths --describe
Installed Plugins:
  /nix/store/x7zxpmqp10mgh5jcx22v4l7naxl3jwsd-fuel-latest/bin/forc-deploy               No description found for this plugin.
  /nix/store/x7zxpmqp10mgh5jcx22v4l7naxl3jwsd-fuel-latest/bin/forc-run          Run script project. Crafts a script transaction then sends it to a running node
  /nix/store/x7zxpmqp10mgh5jcx22v4l7naxl3jwsd-fuel-latest/bin/forc-fmt          Forc plugin for running the Sway code formatter.
  /nix/store/x7zxpmqp10mgh5jcx22v4l7naxl3jwsd-fuel-latest/bin/forc-explore              Forc plugin for running the Fuel Block Explorer.
  /nix/store/x7zxpmqp10mgh5jcx22v4l7naxl3jwsd-fuel-latest/bin/forc-wallet               A forc plugin for generating or importing wallets using BIP39 phrases.
  /nix/store/x7zxpmqp10mgh5jcx22v4l7naxl3jwsd-fuel-latest/bin/forc-lsp          Forc plugin for the Sway LSP (Language Server Protocol) implementation.

It is a little minimal and janky, but perhaps this is enough to get by for now? That said, if you'd like to improve this as a part of your fuelup plugin standardization work I think that makes sense. In retrospect, plugins probably isn't the best name for this command as it lists the plugin commands, not the plugins themselves.

If we do go with list instead, I think it could be worth separating those commands provided by plugins from those that are native to forc, as I think cargo --list can be a little confusing as it's unclear which commands are native and which are provided by plugins.

@eightfilms
Copy link
Contributor

if you'd like to improve this as a part of your fuelup plugin standardization work

Nope, this doesn't affect fuelup standardization work and I don't think it's some urgent work, it was just something that came up in my mind. It's true that forc plugins exist but I think it isn't immediately obvious that forc deploy as a command comes as part of forc-client which is a plugin, and that people expect deploy to show up as a command when they do forc help.

But yeah, you're right, we can let people know that those commands are plugins and they can see them using the forc plugins command.

@adlerjohn
Copy link
Contributor Author

This issue was initially meant as a stepping stone to #482, which was implemented by other means. Can this issue be closed?

@eightfilms
Copy link
Contributor

eightfilms commented Sep 23, 2022

Sounds good, I revived the issue again with my comment above after noticing some devs running into the no such subcommand: 'deploy' error message, especially after the deploy and run commands were extracted out of forc. We can always open this back up if we think a feature like this is useful.

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 good first issue Good for newcomers P: low
Projects
Status: Done
Development

No branches or pull requests

4 participants