GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix cloud-tool to list all the available apis · folkcode/cloudstack@b9a2423

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cloud-cli
    • cloudapis
      • cloud.py
    • cloudtool
      • __init__.py
      • utils.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cloud-cli/cloudapis/cloud.py‎

Copy file name to clipboardExpand all lines: cloud-cli/cloudapis/cloud.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,5 @@ def %s(%s):
111111
implementor = CloudAPI
112112

113113
del name,meth,describe,load_dynamic_methods
114+
115+
Collapse file

‎cloud-cli/cloudtool/__init__.py‎

Copy file name to clipboardExpand all lines: cloud-cli/cloudtool/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def main(argv=None):
2020
api = __import__("cloudapis")
2121
apis = getattr(api, "implementor")
2222
if len(prelim_args) == 0:
23-
parser.error("you need to specify an API as the first argument\n\nSupported APIs:\n" + "\n".join(utils.get_api_list()))
23+
parser.error("you need to specify an API as the first argument\n\nSupported APIs:\n" + "\n".join(utils.get_api_list(apis)))
2424
elif len(prelim_args) == 1:
2525
commandlist = utils.get_command_list(apis)
2626
parser.error("you need to specify a command name as the second argument\n\nCommands supported by the %s API:\n"%prelim_args[0] + "\n".join(commandlist))
Collapse file

‎cloud-cli/cloudtool/utils.py‎

Copy file name to clipboardExpand all lines: cloud-cli/cloudtool/utils.py
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,13 @@ def lookup_command_in_api(api,command_name):
165165
command = getattr(api,command_name.replace("-","_"),None)
166166
return command
167167

168-
def get_api_list():
169-
apilist = []
170-
for api in apis.get_all_apis():
171-
api_module = api
172-
api_name = api.__name__.split(".")[-1]
173-
if not api_name.startswith("_") and hasattr(api_module,'__doc__'):
174-
apilist.append( " %20s %s"%(api_name.replace("_",'-'),api_module.__doc__) )
175-
return apilist
168+
def get_api_list(api):
169+
apilist = []
170+
for cmd_name in dir(api):
171+
cmd = getattr(api,cmd_name)
172+
if callable(cmd) and not cmd_name.startswith("_"):
173+
apilist.append(cmd_name)
174+
return apilist
176175

177176
def get_command_list(api):
178177
cmds = []

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.