-
Notifications
You must be signed in to change notification settings - Fork 74
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
[ros2launch] legal tab completion of launch files #126
Conversation
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
arg = parser.add_argument( | ||
'launch_arguments', | ||
nargs='*', | ||
help="Arguments to the launch file; '<name>:=<value>' (for duplicates, last one wins)") | ||
arg.completer = LaunchFileNameCompleter() | ||
arg.completer = SuppressCompleterWorkaround() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is SuppressCompleter
not sufficient? It seems to work in other places, e.g. https://github.com/colcon/colcon-package-information/blob/8360ca881e0c51edd8696f3683029badcc301835/colcon_package_information/verb/list.py#L95-L100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate why it does work without the workaround in other cases but not here?
Using
$ tree
.
├── composition
│ ├── asdf.launch.py
│ ├── foo
│ │ ├── bar.launch.py
│ │ └── baz.launch.py
│ └── foo.launch.py
├── composition_launch.py
└── file_i_dont_want_completed.txt
With SupressCompleter()
$ ros2 launch composition <tab><tab>
composition/ composition_launch.py file_i_dont_want_completed.txt
With SupressCompleterWorkaround()
$ ros2 launch composition <tab><tab>
-a --debug --print-description --show-args
composition_demo.launch.py -p -s --show-arguments
-d --print --show-all-subprocesses-output
I haven't tested colcon-package-information
, so I don't know if SuppressCompleter
is working as intended there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if
SuppressCompleter
is working as intended there.
It does.
What version of argcomplete
are you using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argcomplete==1.11.1
, and I was also able to reproduce using upstream master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am missing the part why it is necessary in this case only.
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@dirk-thomas as of 71ae581 the PR now reuses CI (testing just ros2launch) |
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside the comment about the function argument style this works for me.
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Approved, and test failure appears unrelated (compiler warning in C code, but this PR only changes python code). Merging. |
Fixes #118
This fixes one issue, but it took multiple steps:
LaunchFileNameCompleter
belongs on thelaunch_file_name
argument, notlaunch_arguments
.launch_arguments
, since by default it completes all files in the current directoryExposeAddget_launch_file_paths
so I can use it in a new completeris_launch_file
and expose it in APIHere's the folder structure I used for testing
Here are the completions I tested with this PR