Skip to content

Commit

Permalink
cli: improve command descriptions
Browse files Browse the repository at this point in the history
* Shorten/simplify the first line of a couple of command descriptions.
* Add `cylc clean` and `cylc gui` to the list of "selected sub-commands"
  which are listed by default in the `cylc help` page.
* Ensure there is one newline after each description (fixes spacing
  issue with the auto-added ID help).
  • Loading branch information
oliver-sanders committed Jul 6, 2022
1 parent 2f195de commit 33b92c5
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 42 deletions.
3 changes: 2 additions & 1 deletion cylc/flow/scripts/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
Broadcast cannot change [runtime] inheritance.
See also 'cylc reload' - reload a modified workflow definition at run time."""
See also 'cylc reload' - reload a modified workflow definition at run time.
"""

from ansimarkup import parse as cparse
from functools import partial
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/check_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
Use -v/--verbose to see the command invoked to determine the remote version
(all remote cylc command invocations will be of the same form, which may be
site dependent -- see cylc global config documentation."""
site dependent -- see cylc global config documentation.
"""

import sys
from typing import TYPE_CHECKING
Expand Down
6 changes: 4 additions & 2 deletions cylc/flow/scripts/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

"""cylc clean [OPTIONS] ARGS
Remove a stopped workflow from the local scheduler filesystem and remote hosts.
Delete a stopped workflow.
Remove workflow files from the local scheduler filesystem and and remote hosts
the workflow was installed on.
NOTE: this command is intended for workflows installed with `cylc install`. If
this is run for a workflow that was instead written directly in ~/cylc-run and
Expand Down Expand Up @@ -54,7 +57,6 @@
# Only remove the workflow on remote install targets
$ cylc clean foo/bar --remote-only
"""

import asyncio
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/cycle_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
$ export CYLC_TASK_CYCLE_POINT=2010-08
$ export MYTEMPLATE=foo-CCYY-MM.nc
$ cylc cycle-point --offset-years=2 --template=MYTEMPLATE
foo-2012-08.nc"""
foo-2012-08.nc
"""

import os
import sys
Expand Down
32 changes: 18 additions & 14 deletions cylc/flow/scripts/cylc.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,24 +430,28 @@ def cli_help():
# modern terminal)
from colorama import init as color_init
color_init(autoreset=True, strip=False)
commands = [
'clean',
'hold',
'install',
'kill',
'pause',
'play',
'release',
'scan',
'stop',
'trigger',
'tui',
'validate',
]
if 'gui' in COMMANDS:
commands.append('gui')
print(USAGE)
print('Selected Sub-Commands:')
print_command_list(
# print a short list of the main cylc commands
commands=[
'hold',
'install',
'kill',
'pause',
'play',
'release',
'scan',
'stop',
'trigger',
'tui',
'validate'
],
indent=2
commands=commands,
indent=2,
)
print('\nTo see all commands run: cylc help all')
sys.exit(0)
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
after inlining has occurred.
Files in the workflow bin directory and other sub-directories of the
run directory are not currently differenced."""
run directory are not currently differenced.
"""

import sys
from typing import TYPE_CHECKING
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
$ cylc dump --tasks --sort WORKFLOW_ID | grep running
# Display the state of all tasks in a particular cycle point:
$ cylc dump -t WORKFLOW_ID | grep 2010082406"""
$ cylc dump -t WORKFLOW_ID | grep 2010082406
"""

from graphene.utils.str_converters import to_snake_case
import json
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/ext_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
Use the retry options in case the target workflow is down or out of contact.
Note: to manually trigger a task use 'cylc trigger', not this command."""
Note: to manually trigger a task use 'cylc trigger', not this command.
"""

from time import sleep
from typing import TYPE_CHECKING
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/get_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
$ cylc get-resources tutorial/runtime-tutorial
# copy all of the tutorials to your "source" directory:
$ cylc get-resources tutorial"""
$ cylc get-resources tutorial
"""

import sys

Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/get_workflow_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

"""cylc get-workflow-contact [OPTIONS] ARGS
Print contact information of a running workflow."""
Print contact information of a running workflow.
"""

from typing import TYPE_CHECKING

Expand Down
1 change: 0 additions & 1 deletion cylc/flow/scripts/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
The same workflow can be installed with multiple names; this results in
multiple workflow run directories that link to the same workflow definition.
"""

from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/scripts/jobs_kill.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
Read job status files to obtain the names of the job runners and the job IDs
in the runners. Invoke the relevant job runner commands to ask the job runners
to terminate the jobs.
"""

from cylc.flow.job_runner_mgr import JobRunnerManager
from cylc.flow.option_parsers import CylcOptionParser as COP
from cylc.flow.terminal import cli_function
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/scripts/jobs_poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
Read job status files to obtain the statuses of the jobs. If necessary, Invoke
the relevant job runner commands to ask the job runners for more statuses.
"""

from cylc.flow.job_runner_mgr import JobRunnerManager
from cylc.flow.option_parsers import CylcOptionParser as COP
from cylc.flow.terminal import cli_function
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/scripts/jobs_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
Submit task jobs to relevant job runners.
On a remote job host, this command reads the job files from STDIN.
"""

from cylc.flow.option_parsers import CylcOptionParser as COP
from cylc.flow.terminal import cli_function
from cylc.flow.job_runner_mgr import JobRunnerManager
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
groupings that are collapsible in cylc visualisation tools.
To visualize the full multiple inheritance hierarchy use:
$ cylc graph -n"""
$ cylc graph -n
"""

import os
import sys
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
to the reload (only changes to the flow.cylc file itself are reloaded).
If the modified workflow definition does not parse, failure to reload will
be reported but no harm will be done to the running workflow."""
be reported but no harm will be done to the running workflow.
"""

from functools import partial
from typing import TYPE_CHECKING
Expand Down
1 change: 0 additions & 1 deletion cylc/flow/scripts/remote_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- Print task_remote_cmd.REMOTE_INIT_DONE
1:
On failure.
"""

from cylc.flow.option_parsers import CylcOptionParser as COP
Expand Down
1 change: 0 additions & 1 deletion cylc/flow/scripts/remote_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
Remove ".service/contact" from a task remote (i.e. a [owner@]host).
Remove ".service" directory on the remote if emptied.
Remove authentication keys.
"""

from cylc.flow.option_parsers import CylcOptionParser as COP
Expand Down
1 change: 0 additions & 1 deletion cylc/flow/scripts/report_timings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
For long-running or large workflows (i.e. workflows with many task events),
the database query to obtain the timing information may take some time.
"""

import collections
Expand Down
5 changes: 3 additions & 2 deletions cylc/flow/scripts/set_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

"""cylc set-outputs [OPTIONS] ARGS
Artificially mark task outputs as completed and spawn downstream tasks that
Artificially satisfy task outputs.
Mark task outputs as completed and spawn downstream tasks that
depend on those outputs. By default it marks tasks as succeeded.
This allows you to manually intervene with Cylc's scheduling algorithm by
Expand All @@ -43,7 +45,6 @@
$ cylc set-outputs --flow=3 --output=x my_flow//1/foo
Use --output multiple times to spawn off of several outputs at once.
"""

from functools import partial
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
--now is used.
This command exits immediately unless --max-polls is greater than zero, in
which case it polls to wait for workflow shutdown."""
which case it polls to wait for workflow shutdown.
"""

from functools import partial
import sys
Expand Down
8 changes: 3 additions & 5 deletions cylc/flow/scripts/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
Trigger tasks - i.e. tell them to run even if they are not ready.
Triggering an unqueued waiting task queues it, regardless of prerequisites.
Triggering a queued waiting task submits it, regardless of queue limiting.
Triggering a submitted or running task has no effect (already triggered).
* Triggering an unqueued waiting task queues it, regardless of prerequisites.
* Triggering a queued waiting task submits it, regardless of queue limiting.
* Triggering a submitted or running task has no effect (already triggered).
Incomplete and active-waiting tasks in the n=0 window already belong to a flow.
Triggering them queues them to run (or rerun) in the same flow;
Expand Down
3 changes: 2 additions & 1 deletion cylc/flow/scripts/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
If the workflow definition uses include-files reported line numbers
will correspond to the inlined version seen by the parser; use
'cylc view -i,--inline WORKFLOW' for comparison."""
'cylc view -i,--inline WORKFLOW' for comparison.
"""

from ansimarkup import parse as cparse
from optparse import Values
Expand Down

0 comments on commit 33b92c5

Please sign in to comment.