Skip to content

Autogenerate sctool docs from yaml files#2987

Merged
mmatczuk merged 1 commit intoscylladb:masterfrom
dgarcia360:autogenerate-docs-commands
Jan 11, 2022
Merged

Autogenerate sctool docs from yaml files#2987
mmatczuk merged 1 commit intoscylladb:masterfrom
dgarcia360:autogenerate-docs-commands

Conversation

@dgarcia360
Copy link
Copy Markdown
Contributor

@dgarcia360 dgarcia360 commented Dec 22, 2021

Closes #2930

Autogenerates sctool docs from YAML files using the extension sphinxcontrib.datatemplates.

How to test this PR

  1. Clone this PR. For more information, see Cloning pull requests locally.

  2. Enter the docs folder, and run:

make preview
  1. Open http://127.0.0.1:5500/sctool/ with your favorite browser and preview the docs.

Before merging this PR ...

Would it be possible to update the autogenerated YAML files?

  1. Sphinx needs a special character to detect lists. For example:
    '*' - matches any number of any characters including none
    '?' - matches any single character
    '[abc]' - matches one character given in the bracket
    '[a-z]' - matches one character from the range given in the bracket

Must be:

    * '*' - matches any number of any characters including none
    * '?' - matches any single character
    * '[abc]' - matches one character given in the bracket
    * '[a-z]' - matches one character from the range given in the bracket
  1. To highlight inline-code (e.g. abc), replace the single quotes as follows 'abc' -> ``[abc]``.

Future improvements

  • Add a collapsible component in the theme to hide "inherited options".
  • Support for more than one example per command. For example, instead of:
example: |
  sctool status -c prod-cluster
  Datacenter: eu-west

The example key could look like this:

examples: 
   - name: Example A 
      description: Example description
     command: sctool xyz
   - name: Example B
      description: Example description
     command: sctool xyz

Adding the new keys name and description will also be possible to format commands as code-blocks and descriptions as regular text.

Comment thread docs/source/sctool/backup.rst Outdated
Comment thread docs/source/sctool/backup.rst
@dgarcia360 dgarcia360 changed the title Autogenerate docs commands Autogenerate docs commands from yaml files Dec 22, 2021
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/task.rst Outdated
Comment thread docs/source/sctool/cluster.rst Outdated
@mmatczuk
Copy link
Copy Markdown
Contributor

@dgarcia360 please note that there are changes in commands and command layout.
There is no point to find an exact mapping here.

Comment thread docs/source/sctool/partials/sctool_progress.yaml
@dgarcia360 dgarcia360 force-pushed the autogenerate-docs-commands branch 4 times, most recently from 5ead3b4 to 1fe86f8 Compare December 29, 2021 14:17
@dgarcia360 dgarcia360 changed the title Autogenerate docs commands from yaml files Autogenerate sctool docs from yaml files Dec 29, 2021
Replace characters test

Remove supress_warning

Rollback change

Update list format

Add task commands

Added example

Rollback

Rollback

Rollback

Hide titles if values not set

Rollback
@dgarcia360 dgarcia360 force-pushed the autogenerate-docs-commands branch from 1fe86f8 to 8bafa25 Compare December 29, 2021 14:43
@dgarcia360 dgarcia360 requested a review from mmatczuk December 29, 2021 14:54
@dgarcia360 dgarcia360 marked this pull request as ready for review December 29, 2021 14:55
@mmatczuk
Copy link
Copy Markdown
Contributor

mmatczuk commented Jan 5, 2022

@dgarcia360 can we merge it i.e. won't it break the 2.5 2.6 and so on?
We want that for master only for now.

@dgarcia360
Copy link
Copy Markdown
Contributor Author

@mmatczuk I've tested it locally and it should not break previous versions.

@dgarcia360
Copy link
Copy Markdown
Contributor Author

dgarcia360 commented Jan 10, 2022

Notes from 05th Jan 2022 call with @tzach

Once we merge this PR:

  • @dgarcia360 will update the docstrings as described in Before merging this PR, and submit a PR.
  • @dgarcia360 will create issues for the recommendations described in Future improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: generate the sctool docs from command spec

2 participants