diff --git a/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py b/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py index 433f76d1..42dc977e 100644 --- a/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py +++ b/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py @@ -1,5 +1,7 @@ from __future__ import annotations +import re + from typing import TYPE_CHECKING from .Cmd import Cmd, Parent @@ -11,23 +13,27 @@ if TYPE_CHECKING: class BaseCmdPkgRelations(Cmd): + arg_sep = r'[,\s|]' + def pkg_relations(self, rel_type: str, args: Namespace) -> str: return args.delimiter.join( pkg_relations_list( self.app, rel_type = rel_type, - flavours = args.flavours.split(','), + flavours = re.split(self.arg_sep, args.flavours), seed_pkgs = args.modules, - subsections = None - if args.subsections is None else args.subsections.split(','), + subsections = ( + None if args.subsections is None else + re.split(self.arg_sep, args.subsections) + ), no_subpackages = args.no_subpackages, dont_strip_revision = args.dont_strip_revision, expand_semver_revision_range = args.expand_semver_revision_range, syntax = VersionSyntax[args.syntax.replace('-', '_')], recursive = args.recursive, dont_expand_version_macros = args.dont_expand_version_macros, - ignore = set(args.ignore.split(',')), + ignore = set(re.split(self.arg_sep, args.ignore)), quote = args.quote, skip_excluded = args.skip_excluded, hide_self = args.hide_self, @@ -49,7 +55,7 @@ class BaseCmdPkgRelations(Cmd): '--subsections', nargs = '?', default = None, - help = 'Subsections to consider, comma-separated', + help = 'Subsections to consider, separated by comma or whitespace', ) parser.add_argument( '-d', @@ -59,7 +65,9 @@ class BaseCmdPkgRelations(Cmd): help = 'Output words delimiter' ) parser.add_argument( - 'flavours', help = 'Dependency flavours (run, build, devel, release)' + 'flavours', + help = 'Dependency flavours (run, build, devel, release), ' + 'separated by comma or whitespace' ) parser.add_argument('modules', nargs = '*', help = 'Modules') parser.add_argument(