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

Function _parse_az_command

tools/stop-boxes.py:25–40  ·  view source on GitHub ↗

Parse an az command into a list of arguments for subprocess.run

(command)

Source from the content-addressed store, hash-verified

23
24
25def _parse_az_command(command):
26 '''Parse an az command into a list of arguments for subprocess.run'''
27 if isinstance(command, list):
28 args = command
29 elif isinstance(command, str):
30 args = command.split()
31 else:
32 raise ValueError(f'az command must be a string or list, not {type(command)}')
33
34 az = shutil.which('az')
35 if args[0] == 'az':
36 args.pop(0)
37 if args[0] != az:
38 args = [az] + args
39
40 return args
41
42
43def _az(command, log_command=True):

Callers 1

_azFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected