MCPcopy Create free account
hub / github.com/Azure/dev-box-images / _parse_command

Function _parse_command

builder/azure.py:54–71  ·  view source on GitHub ↗

Parses a command (string or list of args), adds the required arguments, and replaces executable with full path

(command)

Source from the content-addressed store, hash-verified

52
53
54def _parse_command(command):
55 '''Parses a command (string or list of args), adds the required arguments, and replaces executable with full path'''
56 if isinstance(command, list):
57 args = command
58 elif isinstance(command, str):
59 args = command.split()
60 else:
61 raise ValueError(f'az command must be a string or list, not {type(command)}')
62
63 az = shutil.which('az')
64
65 if args[0] == 'az':
66 args.pop(0)
67
68 if args[0] != az:
69 args = [az] + args
70
71 return args
72
73
74def cli(command, log_command=True):

Callers 2

cliFunction · 0.70
cli_asyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected