help: show plugin commands

exec
dece 3 years ago
parent 8725ecd32c
commit 1a221d30b8

@ -725,7 +725,7 @@ class Browser:
def open_help(self):
"""Show the help page."""
self.open_internal_page("help", get_help(self.config))
self.open_internal_page("help", get_help(self.config, self.plugins))
def prompt(self, text: str, keys: str ="yn"):
"""Display the text and allow it to type one of the given keys."""

@ -54,6 +54,7 @@ Commands are mostly for actions requiring user input. You can type a command wit
* i(nfo): show page informations
* forget-certificate <hostname>: remove saved fingerprint for this hostname
* set-render-mode: set render mode preference for the current URL
{plugin_commands}
## Configuration
@ -80,24 +81,33 @@ Notes:
1: For the "command" parameters such as source_editor and command_editor, a string list is used to separate the different program arguments, e.g. if you wish to use `vim -c 'startinsert'`, you should write the list `["vim", "-c", "startinsert"]`. In both case, a temporary or regular file name will be appended to this command when run.
2: The external_commands dict maps MIME types to commands just as above. For example, if you want to open video files with VLC and audio files in Clementine, you can use the following dict: `{"audio": ["clementine"], "video": ["vlc"]}`. For now only "main" MIME types are supported, i.e. you cannot specify precise types like "audio/flac", just "audio".
2: The external_commands dict maps MIME types to commands just as above. For example, if you want to open video files with VLC and audio files in Clementine, you can use the following dict: `{{"audio": ["clementine"], "video": ["vlc"]}}`. For now only "main" MIME types are supported, i.e. you cannot specify precise types like "audio/flac", just "audio".
3: The generate_client_cert_command uses the same format as other commands (specified in note 1 above), with the exception that if the strings "{cert_path}", "{key_path}" or "{common_name}" are present in any string for the list, they will be replaced respectively by the certificate output path, the key output path and the CN to use.
3: The generate_client_cert_command uses the same format as other commands (specified in note 1 above), with the exception that if the strings "{{cert_path}}", "{{key_path}}" or "{{common_name}}" are present in any string for the list, they will be replaced respectively by the certificate output path, the key output path and the CN to use.
4: The enabled_plugins list contain plugin names to load. Plugins are available if they are installed Python packages that can be imported using the `bebop_<plugin-name>` package name.
Your current configuration is:
{current_config}
"""
def get_help(config):
def get_help(config, plugins):
plugin_commands = "\n".join(
f"* {command.name}: {command.description}"
for plugin in plugins
for command in plugin.commands
)
config_list = "\n".join(
(
f'* {key} = {value} (default {repr(DEFAULT_CONFIG[key])})'
f"* {key} = {value} (default {repr(DEFAULT_CONFIG[key])})"
if value != DEFAULT_CONFIG[key]
else f'* {key} = {value}'
else f"* {key} = {value}"
)
for key, value in config.items()
)
return HELP_PAGE + config_list
return HELP_PAGE.format(
plugin_commands=plugin_commands,
current_config=config_list
)

Loading…
Cancel
Save