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

Picocli 4.6.3 : autocompletion of directory names not working anymore #1644

Closed
philgdn opened this issue Mar 31, 2022 · 17 comments · Fixed by #1863
Closed

Picocli 4.6.3 : autocompletion of directory names not working anymore #1644

philgdn opened this issue Mar 31, 2022 · 17 comments · Fixed by #1863
Labels
theme: auto-completion An issue or change related to auto-completion type: bug 🐛
Milestone

Comments

@philgdn
Copy link

philgdn commented Mar 31, 2022

I'm facing a regression with Picocli 4.6.3 : the autocompletion of filenames doesn't work anymore.

The help of my OdsManager app:

OdsManager extractLoadOds [-hV] [-p PROPERTIES] [JOBFILE [--maxErrorsByExtraction MAX_ERRORS] [--[no-]cleanBeforeExtract] [-f | -s SINCE]] [[--commitAfter <commitLoadAfter>]

When I enter OdsManager extractLoadOds on the command line, with Picocli 4.6.2 hitting the TAB twice I was getting the possibility to autocomplete directory names for the JOBFILE parameter:

  • if I hit TAB twice I get the list of files and directories in the current directory
  • if I then type jo TAB TAB (for the existing jobs/ directory)... I get no suggestions

This was working in 4.6.2 but doesn't work anymore in 4.6.3.

@remkop remkop added the theme: auto-completion An issue or change related to auto-completion label Apr 1, 2022
@remkop remkop added this to the 4.7 milestone Apr 1, 2022
@remkop
Copy link
Owner

remkop commented Apr 1, 2022

Thank you for raising this!
I will take a look.

@remkop
Copy link
Owner

remkop commented Jun 6, 2022

I finally had some time to look at this.
This seems to be caused by this change: #1473: if I comment out the local IFS=$'\n' in the completion script section for the positional parameter, completion seems to work for partial directory names.

I need to spend more time debugging this.

@NewbieOrange
Copy link
Contributor

@philgdn
Copy link
Author

philgdn commented Oct 20, 2022

Sorry I missed your message of September 1.

With the provided picocompletion-demo_completion.bash script I get the completion for the directory names

@NewbieOrange
Copy link
Contributor

Can you provide a minimal example to reproduce the issue?

@philgdn
Copy link
Author

philgdn commented Oct 21, 2022

Here are examples (not so minimal sorry) : Examples.zip

  • SolifeOdsBatchManager_completion_462 was generated by Picocli 4.6.2 and works as expected
  • SolifeOdsBatchManager_completion_463 was generated by Picocli 4.6.3 : autocompletion don't work for directories

To reproduce the problem (with SolifeOdsBatchManager_completion_463) in a directory containing files and directories type (for example a directory dir1 :

SolifeOdsBatchManager extractLoadOds d then TAB.

The autocompletion should complete the dir1 directory... but it doesn't

@remkop
Copy link
Owner

remkop commented Oct 23, 2022

Hi @NewbieOrange, great to hear from you!
I would like to include a fix for this issue (#1644) in the picocli 4.7 release;
this ticket has been on my radar but I never got time to look at it... 😓

I believe the #1759 PR is related because it also looks at setting local IFS=$'\n' in the completion script.

@NewbieOrange
Copy link
Contributor

NewbieOrange commented Oct 23, 2022

@remkop after some debugging, the issue seems to be caused by COMPREPLY has been set with wrong IFS; and this should be fixed by #1759.

edit: @philgdn maybe you can test with #1759?

@remkop
Copy link
Owner

remkop commented Oct 23, 2022

Oh awesome! 🤩
So, #1759 will also fix #1644?
Thank you for looking into this!

@philgdn
Copy link
Author

philgdn commented Oct 24, 2022

@remkop after some debugging, the issue seems to be caused by COMPREPLY has been set with wrong IFS; and this should be fixed by #1759.

edit: @philgdn maybe you can test with #1759?

@NewbieOrange , here is the completion generated with the #1759 : SolifeOdsBatchManager_completion_1759.zip

Unfortunately it doen't work yet with directory names !

@NewbieOrange
Copy link
Contributor

@remkop after some debugging, the issue seems to be caused by COMPREPLY has been set with wrong IFS; and this should be fixed by #1759.
edit: @philgdn maybe you can test with #1759?

@NewbieOrange , here is the completion generated with the #1759 : SolifeOdsBatchManager_completion_1759.zip

Unfortunately it doen't work yet with directory names !

Looks #1759 introduced another issue... Please try #1863

@philgdn
Copy link
Author

philgdn commented Oct 27, 2022

@NewbieOrange , here is the completion generated with the #1863 : SolifeOdsBatchManager_completion_1863.zip

The completion of directory names works now !

BUT it is now the commands that doesn't work anymore.

  • if I type SolifeOdsBatchManager extract then TAB (to get extractOds or extractLoadOds) no completion is suggested
  • if I type SolifeOdsBatchManager then TAB the list of all commands is printed on the line

@NewbieOrange
Copy link
Contributor

@philgdn can you try with #1863 again?

@philgdn
Copy link
Author

philgdn commented Oct 29, 2022

@philgdn can you try with #1863 again?

@NewbieOrange , it's OK now : completion of commands AND directory names are working!

Thanks four your help!

@NewbieOrange
Copy link
Contributor

@remkop fixed by #1863

@NewbieOrange
Copy link
Contributor

Hi, @philgdn can you please retest with #1863? To fix the tests I made some changes ❤️

@philgdn
Copy link
Author

philgdn commented Oct 31, 2022

@NewbieOrange , it's still OK: completion of commands AND directory names are working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: auto-completion An issue or change related to auto-completion type: bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants