Skip to content

Commit 05b8116

Browse files
committed
print basenames by default, option to print full path
1 parent 3db405c commit 05b8116

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

ros2pkg/ros2pkg/verb/executables.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
16+
1517
from ros2pkg.api import get_executable_paths
1618
from ros2pkg.api import get_package_names
1719
from ros2pkg.api import package_name_completer
@@ -27,6 +29,11 @@ def add_arguments(self, parser, cli_name):
2729
'package_name', nargs='?',
2830
help='The package name')
2931
arg.completer = package_name_completer
32+
parser.add_argument(
33+
'--full-path',
34+
action='store_true',
35+
default=False,
36+
help='Show full path of each executable')
3037

3138
def main(self, *, args):
3239
if args.package_name is None:
@@ -44,4 +51,7 @@ def main(self, *, args):
4451
"Package '{args.package_name}' not found"
4552
.format_map(locals()))
4653
for path in sorted(paths):
47-
print(path)
54+
if args.full_path:
55+
print(path)
56+
else:
57+
print(package_name, os.path.basename(path))

0 commit comments

Comments
 (0)