Commit Graph

556 Commits

Author SHA1 Message Date
Tony Breeds e04606ee60 Retire Packaging Deb project repos
This commit is part of a series to retire the Packaging Deb
project. Step 2 is to remove all content from the project
repos, replacing it with a README notification where to find
ongoing work, and how to recover the repo if needed at some
future point (as in
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project).

Change-Id: I41a3e231882883484b2929706e5ea57616259784
2017-09-12 15:57:02 -06:00
OpenStack Proposal Bot 772e16d6bb Updated from global requirements
Change-Id: I410dd168465d276c58a25cab624f8d8e0ac3eb99
2017-07-08 00:44:40 +00:00
Doug Hellmann d025ad9cd3 add tests for display command classes and hooks
Change-Id: Icf17fbcedf3ea9481abef0fd9ebb435648693be3
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-07-06 15:39:39 -07:00
Rajath Agasthya c6d258da1c Run hooks for DisplayCommandBase
Command base class has provisions to run hooks for a command in
its run() method. We need to do the same for the
DisplayCommandBase class since it does not call super().run()

Change-Id: Ic5481523d4bd919fe7fb10e00330dea2ff688ec4
2017-07-06 15:39:39 -07:00
Jenkins 0c378ba96f Merge "add --fit-width option to table formatter" 2017-07-05 19:03:13 +00:00
Doug Hellmann 180d7ce3ce add --fit-width option to table formatter
Change the table formatter to not fit the terminal width by default. Add
a new --fit-width option to turn on that behavior. Width fitting is
implied if the --max-width argument is used. The old behavior can be
restored by setting CLIFF_FIT_WIDTH=1 in the shell environment.

Change-Id: I7b41b38ed25def416605d38c962aea55de842529
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-07-05 16:25:36 +00:00
Akihiro Motoki ccd2e048c6 sphinxext: Add 'application' option to the autoprogram directive
In some cases, a single documentation build wants to handle multiple
cliff-based CLI. One possible example is openstack-manuals CLI ref.
In this case, the global setting 'autoprogram_cliff_application'
does not work. It is nice if we can specify an application name
per autoprogram-cliff directive.
This commit introduces a new option 'application' to
autoprogram-cliff directive to allow this.

Change-Id: Ie2d01920dc04f2a92031a641d809f7da8af8b395
2017-07-03 09:17:41 +09:00
Doug Hellmann 807c910c4f use openstackdocstheme html context
Set some of the new config values and enable openstackdocstheme as an
extension so it will inject values into the page context as it writes
each documentation page. This ensures the pages link to the right bug
tracker, etc.

Change-Id: I0bc0f1c42e1e54af0dc29d7dfcb23293a3347723
Depends-On: Icf3a40ed104cfd828f532f6f2b112ed02f996ff5
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 22:54:10 +00:00
Jenkins d713da39ce Merge "switch from oslosphinx to openstackdocstheme" 2017-06-30 21:20:19 +00:00
Jenkins acf7302836 Merge "sphinext: Use metavar where possible" 2017-06-30 21:01:40 +00:00
Jenkins d2518d216d Merge "Fix erroneous line in command hook test" 2017-06-30 21:01:32 +00:00
Jenkins ed274a8b05 Merge "make smart help formatter test deterministic" 2017-06-30 21:01:27 +00:00
Doug Hellmann efa324ac05 switch from oslosphinx to openstackdocstheme
Change-Id: Ife54259642bd71b899d34fa8d18ccc90e6f35bc2
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 13:35:52 -05:00
Jenkins 93bc45bfeb Merge "remove references to distribute in the docs" 2017-06-30 18:18:07 +00:00
Rajath Agasthya 14f8beb61b Fix erroneous line in command hook test
Change-Id: Ib783800018444df7204f5971c96c7bd83079bd41
2017-06-30 10:03:29 -07:00
Doug Hellmann 0a7157de64 make smart help formatter test deterministic
Set up the formatter to always use a width=80 so that the terminal width
of the developer's system does not cause the test to fail. Trying to
mock os.environ failed, but there is an arg to HelpFormatter to set the
width explicitly. Unfortunately, there is no way to do that through the
parser, so we have to replace the parser's formatter_class attribute
with a partial() that passes width to the original class.

Change-Id: I2ab035b5b188f1a028e1776ba9f09c71dc316c11
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 17:01:33 +00:00
Jenkins 7279f4b096 Merge "add before and after hooks" 2017-06-30 16:56:35 +00:00
Jenkins f9466f238d Merge "add hook for get_epilog" 2017-06-30 16:56:30 +00:00
Jenkins cc02cc85f2 Merge "add hook for manipulating the argument parser" 2017-06-30 16:48:06 +00:00
Jenkins 1e8228b524 Merge "Updated from global requirements" 2017-06-30 15:15:43 +00:00
Doug Hellmann d4f3c49d40 remove references to distribute in the docs
distribute is dead, long live setuptools

Change-Id: Iedf1fafeb1178aa9e7b74d67f87c10166026820d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 09:50:30 -04:00
Doug Hellmann 95c749d55e add before and after hooks
Add hooks that are called before and after the take_action() method of
the command.

Change-Id: Id6527dfe0946c0ab169fc165b84d40f3ff95e08c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 09:50:21 -04:00
Doug Hellmann 45de8e45ef add hook for get_epilog
Change-Id: If3fe077522c156472a0213e8768470e0505c189d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 09:50:12 -04:00
Doug Hellmann e72e54e757 add hook for manipulating the argument parser
Update Commands to load a separate set of extensions to be used as
"hooks," triggered at different points in the processing of the
command. Start with a hook that is given access to the argument parser
for the command so it can modify it.

Change-Id: I0785548fd36a61cda616921a4a21be3f67701300
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-30 09:50:07 -04:00
OpenStack Proposal Bot 6c1c1ed1ac Updated from global requirements
Change-Id: Idf7bcc957a961e76ecb48537b379177996a4f476
2017-06-30 12:13:35 +00:00
Doug Hellmann decac4318e pass the command name from HelpCommand
When the help command instantiates another command class to get its help
text, it needs to pass the command's name if the class supports it.

Change-Id: I3507f723dc8b4e68db80d6da053be61026823457
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-29 22:29:01 -07:00
Jenkins 790a26ed00 Merge "add cmd_name argument to CompleteCommand" 2017-06-29 23:02:56 +00:00
Jenkins 8b158e086c Merge "rearrange existing content to follow new standard" 2017-06-29 19:42:35 +00:00
Jenkins 6862d0a105 Merge "sphinxext: Use 'argparse.description', 'argparse.epilog'" 2017-06-29 18:08:32 +00:00
Dirk Mueller 40b75d8dc2 Adjust completenames tests for cmd2 0.7.3+
cmd2 0.7.3 started to override Cmd.completenames with a function
taking additional parameters:

  Cmd2.completenames(self, text, line, begidx, endidx)

over the Cmd version:

  Cmd.completenames(self, text, *ignored)

With this change we adjust the override to the new signature.

Change-Id: I7b110502c20ec16c6032cce31021eee3f85255fc
Closes-Bug: #1700250
2017-06-28 07:45:44 +02:00
Doug Hellmann 44db83ff0b rearrange existing content to follow new standard
Change-Id: Ib923265aaab4c001e5313800002aae63b159ec0d
Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-22 13:26:05 -04:00
Stephen Finucane 632b12a3f7 sphinext: Use metavar where possible
The Sphinx 'option' directive only allows optional parameter arguments
to be surrounded by brackets - not positional arguments. As a result,
'cliff.sphinxext' will ignore 'action.metavar' for positional arguments
due to the proclivity of said metavars to include surrounding brackets.
However, 'action.metavar' is sometimes important like, for example, when
'action.metavar' is a singular form but 'action.dest' is a plural form.
This can prove very confusing to users.

Start using 'action.metavar' by stripping out these brackets when they
occur. This ensures we get a pretty good approximation of the intent
without breaking Sphinx.

Change-Id: I114fe551f2a249faa49b419e18a99228627a8e83
2017-06-08 12:00:23 +01:00
Stephen Finucane 2e27ef0e38 sphinxext: Use 'argparse.description', 'argparse.epilog'
We actually initialize the 'ArgumentParser' created in
'Command.get_parser' with the description and epilog values of the
'Command' itself. By using the 'ArgumentParser' value, we can easily
test the parser.

Change-Id: I3bf9de3ce5b8d5aa4adc55155767cb9e7a4ead11
2017-06-08 11:39:43 +01:00
Stephen Finucane 8d85b1c9a4 sphinxext: Allow configuration of ignorable options
At the moment, the help action (-h, --help) is ignored by default.
However, there is merit in being able to ignore further options. Make it
so.

Change-Id: I924d89fd6b602accac90604a3427b19bd4f9777a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2017-06-06 10:59:08 +01:00
Stephen Finucane 78f188023c sphinxext: Generate better usage examples
At the moment, the 'autoprogram-cliff' directive uses the default usage
formatter in its output. This is functional but no more. Take, for
example, the following output, generated for the python-openstackclient
project:

  openstack server migrate [--live <hostname>]
                           [--shared-migration | --block-migration]
                           [--disk-overcommit | --no-disk-overcommit] [--wait]
                           <server>

What we actually want is something like the below, which is not only
more legible but also avoids issues like optional argument flags and
the corresponding values being on separate lines:

  openstack server migrate
      [--live <hostname>]
      [--shared-migration | --block-migration]
      [--disk-overcommit | --no-disk-overcommit]
      [--wait]
      <server>

Do this by manually generating our own usage samples, harnessing a
little of the internal argparse infrastructure.

Change-Id: If4dff4991562da9892f1c06f854143b71111007a
2017-05-30 14:53:29 +01:00
Jenkins ff0c10dbcb Merge "Ensure python standard argparse module is loaded" 2017-05-30 01:10:34 +00:00
Doug Hellmann cdc5c0ce24 add cmd_name argument to CompleteCommand
Add the argument so callers will pass it.

Change-Id: Ic2144296de1840de75835eb89fd8145f5ef80e28
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-05-25 18:38:58 -04:00
Akihiro Motoki f2c381c708 Ensure python standard argparse module is loaded
When 'import argparse' is used in cliff.something module,
cliff.argparse is loaded instead of python standard argparse.
This causes cliff.sphinxext failure with no attribute _HelpAction.

This can be avoided by renaming cliff.argparse to non-overlapping
module name like _argparse. cliff.argparse is for internal use,
so I believe it is safe to rename the module.

Closes-Bug: #1692018
Change-Id: Ic34f61581316c662dd2d672bc2c088dcef2100a9
2017-05-20 02:16:34 +09:00
OpenStack Proposal Bot 4a91773315 Updated from global requirements
Change-Id: Ief9b95f3c73776483894b841c7b1b706d8ea6e32
2017-05-17 03:46:44 +00:00
Doug Hellmann c548b7b44c covert test suite to use testrepository
Drop the use of nose in favor of testrepository. Set up the gitignore
rules for the output files.

Add coverage reporting to test jobs.

Update tox.ini so the default environments make sense so it is possible
to just run "tox" for local development.

Change-Id: Ieeffdde3bb8a1869af01f5be2bc682a1a834ba13
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-04-23 10:16:30 -04:00
Jenkins d2f23f3aaf Merge "Add smart help formatter for command parser" 2017-04-20 17:09:04 +00:00
Jenkins b5593752e5 Merge "Updated from global requirements" 2017-04-19 16:48:18 +00:00
OpenStack Proposal Bot 0666094367 Updated from global requirements
Change-Id: Ib7166bc3268ffb986d27b88777a303e356fa3e0a
2017-04-17 17:11:44 +00:00
Rui Chen 9d505a7faf Add smart help formatter for command parser
Some command help messages maybe have multiple line content,
the built-in argparse.HelpFormatter wrap and split the content
according to width, and ignore \n in the raw help message,
it merge multiple line content in one line to output,
that looks messy. SmartHelpFormatter keep the raw help message
format if it contain \n, and wrap long line like HelpFormatter
behavior.

Change-Id: Ib37913891bbf7a31b570404c4668c490d5ac859b
2017-04-14 17:13:03 +08:00
Stephen Finucane f7e3ac4509 Add support for epilogs
An epilog is text that's displayed after the argument help. It can be
useful to provide some broader context as to the command in question.

This change update the 'sphinxext' plugin to include this in its output.

Change-Id: I7f0bf8ba92dc34cc2e3e9fa2a93ec91ee2f9f8ac
2017-04-07 10:31:57 +01:00
Stephen Finucane e7a6a596c5 Add 'autoprogram-cliff' Sphinx directive
Many projects, such as 'python-openstackclient', manually write
documentation for their cliff-based command line tools. In many cases,
this documentation is a 1:1 reflection of what one could build from the
command line. This is unnecessary overhead that could and should be
avoided.

Add an 'autoprogram-cliff' directive that will allow folks to
automatically document their command line tools.

Change-Id: I497e62382768ffc9668a103706001735a7d851ff
2017-04-07 10:31:55 +01:00
Stephen Finucane 6a39ba568c .gitignore: Ignore eggs
Autogenerated stuff. Hide it.

Change-Id: I43797e18dea3f2bc1e0c1263fe07e20137dbd876
2017-04-03 12:53:18 +00:00
Stephen Finucane 64fe476429 Use Sphinx 1.5 warning-is-error
This will ensure doc warnings don't make their way in.

Change-Id: I7ebba63f7d751cfb335cd39c2790250b6aa035dd
2017-03-16 16:54:23 +00:00
Dean Troyer 2fe0353d0a Update cmd2 fix to still work with 0.6.7
I4bb02749a8fafccaff4ef7ce94ff0c4910fb67e6 fixed cmd2 0.7.0 but
broke <=0.7.0.  Detect if Cmd.do_hi() is present to decide what
the response should be to support both cases.

This can be reverted some time after cmd2 0.7.0 is in cliff's
requirements.txt as the minimum version.

Change-Id: I3d42aa68303bed1c302e72d1eab861d355646bc7
2017-03-14 10:57:50 -05:00
Jenkins bdbb18b9ea Merge "Updated from global requirements" 2017-03-14 00:14:41 +00:00