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

Fish shell completions #3435

Closed
sdaitzman opened this issue Mar 22, 2020 · 4 comments
Closed

Fish shell completions #3435

sdaitzman opened this issue Mar 22, 2020 · 4 comments
Assignees
Milestone

Comments

@sdaitzman
Copy link

sdaitzman commented Mar 22, 2020

Configuration

Operating system: macOS

PlatformIO Version (platformio --version): PlatformIO, version 4.0.0

Description of problem

I would love to have Fish Shell completions!

@ivankravets
Copy link
Member

ivankravets commented May 10, 2020

Please re-test with pio upgrade --dev. See docs how to use it https://docs.platformio.org/en/latest/core/userguide/system/completion/index.html

@mcspr
Copy link
Contributor

mcspr commented May 11, 2020

Thanks! re #3449, running pio system completion install multiple times should overwrite instead of append to the completion file? append kwarg seems to do it.

$ cat ~/.config/fish/completions/pio.fish
complete --command pio --arguments "(env _PIO_COMPLETE=complete-fish COMMANDLINE=(commandline -cp) pio)" -f
complete --command pio --arguments "(env _PIO_COMPLETE=complete-fish COMMANDLINE=(commandline -cp) pio)" -f
complete --command pio --arguments "(env _PIO_COMPLETE=complete-fish COMMANDLINE=(commandline -cp) pio)" -f

New versions works for me in fish, as well as raw click-complete patch from the referenced PR. Sadly, dynamic things are still missing, like --board or --environment lists. I have not explored that part more in-depth.


There is also a weird bug when typing pio foo . and TAB

  File "/home/builder/runtime/platformio-core/platformio/commands/__init__.py", line 64, in get_command
    mod = __import__(mod_path, None, None, ["cli"])
ModuleNotFoundError: No module named 'platformio.commands.foo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/builder/runtime/platformio-core/platformio/__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/click/core.py", line 712, in main
    _bashcomplete(self, prog_name, complete_var)
  File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/click_completion/patch.py", line 135, in _shellcomplete
    do_fish_complete(cli, prog_name)
  File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/click_completion/core.py", line 198, in do_fish_complete
    for item, help in get_choices(cli, prog_name, args, incomplete):
  File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/click_completion/core.py", line 86, in get_choices
    ctx = resolve_ctx(cli, prog_name, args)
  File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/click_completion/lib.py", line 82, in resolve_ctx
    cmd = ctx.command.get_command(ctx, a[0])
  File "/home/builder/runtime/platformio-core/platformio/commands/__init__.py", line 70, in get_command
    raise click.UsageError('No such command "%s"' % cmd_name, ctx)
click.exceptions.UsageError: No such command "foo"

@ivankravets ivankravets reopened this May 21, 2020
@ivankravets
Copy link
Member

Please re-test with pio upgrade --dev.

Also please note that command was changed from pio misc to pio system.

@ivankravets
Copy link
Member

Resoled in 7dce494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants