Showing different help on the help page and the command-line.
This commit is contained in:
parent
72be7b44bf
commit
4af3658825
3 changed files with 35 additions and 29 deletions
4
TODO
4
TODO
|
|
@ -4,8 +4,6 @@ Todo
|
|||
- Maybe also use cxfreeze, py2exe, pyrun or zipapp? Is zipapp the standard way?
|
||||
- Use cookiecutter?
|
||||
- Need to use conventional version numbers for pypi. See pep0440.
|
||||
- Only show the 'keys' in the help page, and only show the command line usage
|
||||
on the command line.
|
||||
|
||||
|
||||
Todo (tool related)
|
||||
|
|
@ -164,6 +162,8 @@ Done
|
|||
- Determine if perl files are perl5 or perl6.
|
||||
<- At least done by perl_syntax.
|
||||
- Recognize python test files like: test_*.py
|
||||
- Only show the 'keys' in the help page, and only show the command line usage
|
||||
on the command line.
|
||||
|
||||
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
|
||||
A B C D E F G H
|
||||
|
|
|
|||
|
|
@ -12,23 +12,6 @@
|
|||
│ │
|
||||
│The reports are cached in the codebase's root directory in a ".vigil" directory. │
|
||||
│ │
|
||||
│ │
|
||||
│Usage: │
|
||||
│ vigil [options] <directory> │
|
||||
│ vigil -h | --help │
|
||||
│ │
|
||||
│Example: │
|
||||
│ # vigil my_project │
|
||||
│ │
|
||||
│Options: │
|
||||
│ -h, --help Show this screen and exit. │
|
||||
│ -s on|off, --sandbox=on|off Use a sandbox to prevent changes to the │
|
||||
│ filesystem. The sandbox is on by default. │
|
||||
│ -w COUNT, --workers=COUNT The number of processes working in parallel. │
|
||||
│ By default it is twice the number of cpus. │
|
||||
│ -e "COMMAND", --editor="COMMAND" The command used to start the editor, in │
|
||||
│ the [0m[38;2;0;255;0m[48;2;0;0;0me[0m[38;2;255;255;255m[48;2;0;0;0mdit command. It may contain options. │
|
||||
│ │
|
||||
│Keys: │
|
||||
│ [0m[38;2;0;255;0m[48;2;0;0;0mh[0m[38;2;255;255;255m[48;2;0;0;0m - Show the help screen. (toggle) │
|
||||
│ [0m[38;2;0;255;0m[48;2;0;0;0mq[0m[38;2;255;255;255m[48;2;0;0;0m - Quit. │
|
||||
|
|
@ -57,4 +40,21 @@
|
|||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────┘[0m
|
||||
22
vigil
22
vigil
|
|
@ -16,8 +16,10 @@ by selecting this status indicator with the cursor. The types of status are
|
|||
listed below.
|
||||
|
||||
The reports are cached in the codebase's root directory in a ".vigil" directory.
|
||||
"""
|
||||
|
||||
|
||||
USAGE = """
|
||||
Usage:
|
||||
vigil [options] <directory>
|
||||
vigil -h | --help
|
||||
|
|
@ -33,8 +35,10 @@ Options:
|
|||
By default it is twice the number of cpus.
|
||||
-e "COMMAND", --editor="COMMAND" The command used to start the editor, in
|
||||
the *edit command. It may contain options.
|
||||
"""
|
||||
|
||||
Keys:
|
||||
|
||||
KEYS_DOC = """Keys:
|
||||
*h - Show the help screen. (toggle)
|
||||
*q - Quit.
|
||||
*d, *c, *j, *k, *f, *v or arrow keys or mouse click - Move the cursor.
|
||||
|
|
@ -474,10 +478,8 @@ def _highlight_chars(str_, style, marker="*"):
|
|||
return fill3.join("", [parts[0]] + highlighted_parts)
|
||||
|
||||
|
||||
def _get_help_text():
|
||||
usage = _highlight_chars(__doc__, Log._GREEN_STYLE)
|
||||
return fill3.join(
|
||||
"\n", [usage, "Statuses:"] +
|
||||
def _get_status_help():
|
||||
return fill3.join("\n", ["Statuses:"] +
|
||||
[" " + tools.status_to_str(status) + " " + meaning
|
||||
for status, meaning in tools.STATUS_MEANINGS])
|
||||
|
||||
|
|
@ -495,7 +497,9 @@ class Help:
|
|||
def __init__(self, summary, screen):
|
||||
self.summary = summary
|
||||
self.screen = screen
|
||||
self.view = fill3.View.from_widget(fill3.Text(_get_help_text()))
|
||||
keys_doc = _highlight_chars(KEYS_DOC, Log._GREEN_STYLE)
|
||||
help_text = fill3.join("\n", [__doc__, keys_doc, _get_status_help()])
|
||||
self.view = fill3.View.from_widget(fill3.Text(help_text))
|
||||
self.widget = fill3.Border(self.view, title="Help")
|
||||
portal = self.view.portal
|
||||
self.key_map = _make_key_map([
|
||||
|
|
@ -997,9 +1001,11 @@ def _manage_cache(root_path):
|
|||
|
||||
|
||||
def _check_arguments():
|
||||
arguments = docopt.docopt(__doc__.replace("*", ""), help=False)
|
||||
cmdline_help = __doc__ + USAGE.replace("*", "")
|
||||
arguments = docopt.docopt(cmdline_help, help=False)
|
||||
if arguments["--help"]:
|
||||
print(_get_help_text())
|
||||
print(cmdline_help)
|
||||
print(_get_status_help())
|
||||
sys.exit(0)
|
||||
worker_count = None
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue