mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 22:11:44 -07:00
fixed issue with paths separator and others
finished normalizing of path handling removed overloaded '-p' from init_paths option, it is for role_paths removed expand_tilde and get_opt methods as both were redundant, adjusted rest of code updated tests to match
This commit is contained in:
parent
c426481b33
commit
fedbf3666b
3 changed files with 21 additions and 36 deletions
|
@ -276,14 +276,14 @@ class CLI(with_metaclass(ABCMeta, object)):
|
|||
if op.forks < 1:
|
||||
self.parser.error("The number of processes (--forks) must be >= 1")
|
||||
|
||||
@staticmethod
|
||||
def expand_tilde(option, opt, value, parser):
|
||||
setattr(parser.values, option.dest, os.path.expanduser(value))
|
||||
|
||||
@staticmethod
|
||||
def unfrack_paths(option, opt, value, parser):
|
||||
if isinstance(value, string_types):
|
||||
setattr(parser.values, option.dest, [unfrackpath(x) for x in value.split(os.sep)])
|
||||
setattr(parser.values, option.dest, [unfrackpath(x) for x in value.split(os.pathsep)])
|
||||
elif isinstance(value, list):
|
||||
setattr(parser.values, option.dest, [unfrackpath(x) for x in value])
|
||||
else:
|
||||
pass #FIXME: should we raise options error?
|
||||
|
||||
@staticmethod
|
||||
def unfrack_path(option, opt, value, parser):
|
||||
|
@ -312,7 +312,7 @@ class CLI(with_metaclass(ABCMeta, object)):
|
|||
if module_opts:
|
||||
parser.add_option('-M', '--module-path', dest='module_path', default=None,
|
||||
help="prepend path(s) to module library (default=%s)" % C.DEFAULT_MODULE_PATH,
|
||||
action="callback", callback=CLI.expand_tilde, type=str)
|
||||
action="callback", callback=CLI.unfrack_path, type='str')
|
||||
if runtask_opts:
|
||||
parser.add_option('-e', '--extra-vars', dest="extra_vars", action="append",
|
||||
help="set additional variables as key=value or YAML/JSON", default=[])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue