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:
parent
37d5bcddd4
commit
0af41ac832
2 changed files with 16 additions and 2 deletions
|
|
@ -14,6 +14,13 @@ class CmdExepath(Cmd): # export
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
super().add_arguments(parser)
|
super().add_arguments(parser)
|
||||||
|
parser.add_argument(
|
||||||
|
'-d',
|
||||||
|
'--delimiter',
|
||||||
|
nargs = '?',
|
||||||
|
default = ':',
|
||||||
|
help = 'Output words delimiter'
|
||||||
|
)
|
||||||
parser.add_argument('module', nargs = '*', help = 'Modules')
|
parser.add_argument('module', nargs = '*', help = 'Modules')
|
||||||
|
|
||||||
async def _run(self, args: Namespace) -> None:
|
async def _run(self, args: Namespace) -> None:
|
||||||
|
|
@ -30,4 +37,4 @@ class CmdExepath(Cmd): # export
|
||||||
path = self.app.find_dir(m, ['/bin'])
|
path = self.app.find_dir(m, ['/bin'])
|
||||||
if path is not None:
|
if path is not None:
|
||||||
out.append(path)
|
out.append(path)
|
||||||
print(':'.join(out))
|
print(args.delimiter.join(out))
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,13 @@ class CmdLdlibpath(Cmd): # export
|
||||||
|
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
super().add_arguments(parser)
|
super().add_arguments(parser)
|
||||||
|
parser.add_argument(
|
||||||
|
'-d',
|
||||||
|
'--delimiter',
|
||||||
|
nargs = '?',
|
||||||
|
default = ':',
|
||||||
|
help = 'Output words delimiter'
|
||||||
|
)
|
||||||
parser.add_argument('module', nargs = '*', help = 'Modules')
|
parser.add_argument('module', nargs = '*', help = 'Modules')
|
||||||
|
|
||||||
async def _run(self, args: Namespace) -> None:
|
async def _run(self, args: Namespace) -> None:
|
||||||
|
|
@ -30,4 +37,4 @@ class CmdLdlibpath(Cmd): # export
|
||||||
path = self.app.find_dir(m, ['/lib'])
|
path = self.app.find_dir(m, ['/lib'])
|
||||||
if path is not None:
|
if path is not None:
|
||||||
out.append(path)
|
out.append(path)
|
||||||
print(':'.join(out))
|
print(args.delimiter.join(out))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue