mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
convert so they handle argsfiles rather than arguments
This commit is contained in:
committed by
Michael DeHaan
parent
a9a9e3af65
commit
1f53c89b14
25
library/git
25
library/git
@@ -37,8 +37,31 @@ import subprocess
|
||||
# to a dictionary
|
||||
# FIXME: make more idiomatic
|
||||
|
||||
args = " ".join(sys.argv[1:])
|
||||
if len(sys.argv) == 1:
|
||||
print json.dumps({
|
||||
"failed" : True,
|
||||
"msg" : "the command module requires arguments (-a)"
|
||||
})
|
||||
sys.exit(1)
|
||||
|
||||
argfile = sys.argv[1]
|
||||
if not os.path.exists(argfile):
|
||||
print json.dumps({
|
||||
"failed" : True,
|
||||
"msg" : "Argument file not found"
|
||||
})
|
||||
sys.exit(1)
|
||||
|
||||
args = open(argfile, 'r').read()
|
||||
items = shlex.split(args)
|
||||
|
||||
if not len(items):
|
||||
print json.dumps({
|
||||
"failed" : True,
|
||||
"msg" : "the command module requires arguments (-a)"
|
||||
})
|
||||
sys.exit(1)
|
||||
|
||||
params = {}
|
||||
for x in items:
|
||||
(k, v) = x.split("=")
|
||||
|
||||
Reference in New Issue
Block a user