Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def cli(args=None, input_format="yaml", program_name="yq"):
parser = get_parser(program_name, __doc__)
argcomplete.autocomplete(parser)
args, jq_args = parser.parse_known_args(args=args)
for i, arg in enumerate(jq_args):
if arg.startswith("-") and not arg.startswith("--"):
if "i" in arg:
args.in_place = True
if "y" in arg:
args.output_format = "yaml"
elif "Y" in arg:
args.output_format = "annotated_yaml"
elif "x" in arg:
args.output_format = "xml"
jq_args[i] = arg.replace("i", "").replace("x", "").replace("y", "").replace("Y", "")
if args.output_format != "json":
jq_args[i] = jq_args[i].replace("C", "")