Now the current cinderclient version default use v3 interface.
And the do_list_extensions of V3 inherited V2. The do_list_extensions
of V2 does not have __doc__.For the cli-reference, there is a specific
docs tool used to auto-generate the cli-reference files.The docs tool
find the function __doc__ that starts with 'do_',as The
do_list_extensions's __doc__ is none,so the subcommand 'list-extensions'
no desc.
python-cinderclient/cinderclient/shell.py
---------------------------------
def _find_actions(self, subparsers, actions_module, version,
do_help, input_args):
for attr in (a for a in dir(actions_module) if
a.startswith('do_')):
# I prefer to be hyphen-separated instead of underscores.
command = attr[3:].replace('_', '-')
callback = getattr(actions_module, attr)
desc = callback.__doc__ or ''
.......
The OpenStack contributor guide has instructions. The guide has a
chapter on how to use the duto-generate docs tools
- https://docs.openstack.org/contributor-guide/doc-tools.html
Specifically, the chapter on the command line reference explains
how the tool works -
https://docs.openstack.org/contributor-guide/doc-tools/cli-reference.html
Change-Id: I5484d1e25b4ec11182b27c80fc43e816b1a12736
Closes-Bug: #1674934
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
# Copyright (c) 2013 OpenStack Foundation
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from cinderclient import base
|
|
from cinderclient import utils
|
|
|
|
|
|
class ListExtResource(base.Resource):
|
|
@property
|
|
def summary(self):
|
|
descr = self.description.strip()
|
|
if not descr:
|
|
return '??'
|
|
lines = descr.split("\n")
|
|
if len(lines) == 1:
|
|
return lines[0]
|
|
else:
|
|
return lines[0] + "..."
|
|
|
|
|
|
class ListExtManager(base.Manager):
|
|
resource_class = ListExtResource
|
|
|
|
def show_all(self):
|
|
return self._list("/extensions", 'extensions')
|
|
|
|
|
|
def do_list_extensions(client, _args):
|
|
"""
|
|
Lists all available os-api extensions.
|
|
"""
|
|
extensions = client.list_extensions.show_all()
|
|
fields = ["Name", "Summary", "Alias", "Updated"]
|
|
utils.print_list(extensions, fields)
|