Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore command help reference section #237

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ doc/*
!doc/joss-paper

# derived files
src/appendices/command-ref.rst
src/reference/command-help.rst

# editor stuff
*.swp
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ clean:
# remove auto-generated content
rm -rf src/plugins/main-loop/built-in
rm -rf src/user-guide/task-implementation/job-runner-handlers
rm -rf src/reference/command-help.rst

cleanall:
(cd doc; echo [0-9]*.*)
Expand All @@ -32,6 +33,8 @@ cleanall:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
# NOTE: EXPORT_ALL_VARIABLES exports make vars as env vars
%: Makefile .EXPORT_ALL_VARIABLES
# generate command help transcripts
bin/autodoc-cli
# build documentation
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# write out dict of available versions and formats
Expand Down
46 changes: 5 additions & 41 deletions bin/autodoc-cli
Original file line number Diff line number Diff line change
Expand Up @@ -15,66 +15,30 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Create appendices/command-ref.rst for inclusion in HTML doc.
# Create command help transcripts for inclusion in HTML doc.

# All paths relative to 'doc/src/custom/' directory:
COMMAND_REF_FILE="$(dirname "$0")/../src/appendices/command-ref.rst"
CYLC="cylc"
COMMAND_REF_FILE="$(dirname "$0")/../src/reference/command-help.rst"

cat > "$COMMAND_REF_FILE" <<END
.. _CommandReference:

Command Reference
=================

.. _help:

Help
----

.. code-block:: none

$("${CYLC}" --help | awk '{print " " $0}')

Command Categories
------------------

END

for CAT in $($CYLC categories); do
cat >> "$COMMAND_REF_FILE" <<END

.. _command-cat-${CAT}:

${CAT}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: none

$("$CYLC" "$CAT" --help | awk '{print " " $0}')

END

done

cat >> "$COMMAND_REF_FILE" <<END

Commands
--------

END

for COM in $($CYLC commands); do
for COM in $(cylc help all | awk '{print $1}' | sort); do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI build failed, I think because this line doesn't work if the terminal width is too low ?? (newlines get inserted into the help text)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have to be narrower than the longest command name to trip awk up?!

cat >> "$COMMAND_REF_FILE" <<END

.. _command-${COM}:

${COM}
cylc ${COM}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: none

$("$CYLC" "$COM" --help | awk '{print " " $0}')
$(cylc "$COM" --color=never --help | awk '{print " " $0}')

END

Expand Down
1 change: 1 addition & 0 deletions src/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Reference
config/index
api/index
dev-history-major-changes
command-help