cmds.projects.Cmd[Ldlibpath|Exepath]: Support --delimiter

Support a --delimiter option to the ldlibpath and exepath commands. Notable use case are the JW_PKG_XXX_PATH variables, which should use spaces instead of colons.

TODO: Merging those two command modules with BaseCmdPkgRelations would have made introducing this redundancy unnecessary, check if that's a possibility.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-17 14:28:18 +02:00
commit 2855fe636d
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 16 additions and 2 deletions

View file

@ -14,6 +14,13 @@ class CmdExepath(Cmd): # export
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
parser.add_argument(
'-d',
'--delimiter',
nargs = '?',
default = ':',
help = 'Output words delimiter'
)
parser.add_argument('module', nargs = '*', help = 'Modules')
async def _run(self, args: Namespace) -> None:
@ -30,4 +37,4 @@ class CmdExepath(Cmd): # export
path = self.app.find_dir(m, ['/bin'])
if path is not None:
out.append(path)
print(':'.join(out))
print(args.delimiter.join(out))

View file

@ -14,6 +14,13 @@ class CmdLdlibpath(Cmd): # export
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
parser.add_argument(
'-d',
'--delimiter',
nargs = '?',
default = ':',
help = 'Output words delimiter'
)
parser.add_argument('module', nargs = '*', help = 'Modules')
async def _run(self, args: Namespace) -> None:
@ -30,4 +37,4 @@ class CmdLdlibpath(Cmd): # export
path = self.app.find_dir(m, ['/lib'])
if path is not None:
out.append(path)
print(':'.join(out))
print(args.delimiter.join(out))