MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / execute_command

Function execute_command

web/pgacloud/pgacloud.py:57–79  ·  view source on GitHub ↗

Executes the command in the provider

(providers, parser, args)

Source from the content-addressed store, hash-verified

55
56
57def execute_command(providers, parser, args):
58 """ Executes the command in the provider """
59
60 # Switch - for _ in command names. We use - in the CLI syntax for ease of
61 # use, but we need an _ in Python function names
62 if 'command' in args and args.command is not None:
63 args.command = args.command.replace('-', '_')
64
65 # Figure out what provider the command was for (if any) and call the
66 # relevant function. If we don't get a match, print the help
67 if args.provider in providers and \
68 'command' in args and \
69 args.command is not None:
70 command = providers[args.provider].commands()[args.command]
71 command(args)
72 else:
73 # If no provider has been given, display the top level help,
74 # otherwise, call the help() method in the provider
75 if args.provider is None:
76 parser.print_help()
77 else:
78 command = providers[args.provider].commands()['help']
79 command()
80
81
82def main():

Callers 1

mainFunction · 0.85

Calls 1

commandsMethod · 0.80

Tested by

no test coverage detected