From 62997b9385fccece83636d85d2ecb8e754701536 Mon Sep 17 00:00:00 2001 From: dece Date: Thu, 13 May 2021 01:26:10 +0200 Subject: [PATCH] help: display current config --- BOARD.txt | 1 + bebop/browser/browser.py | 4 ++-- bebop/help.py | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/BOARD.txt b/BOARD.txt index 88d587f..afa95c0 100644 --- a/BOARD.txt +++ b/BOARD.txt @@ -48,3 +48,4 @@ gopher? opt. maintain history between sessions history (forward) (useful?) search in page (ugh) +get/set config using command-line diff --git a/bebop/browser/browser.py b/bebop/browser/browser.py index 87ab523..1678e76 100644 --- a/bebop/browser/browser.py +++ b/bebop/browser/browser.py @@ -17,8 +17,8 @@ from bebop.bookmarks import ( from bebop.colors import ColorPair, init_colors from bebop.command_line import CommandLine from bebop.external import open_external_program -from bebop.help import HELP_PAGE from bebop.fs import get_identities_list_path +from bebop.help import get_help from bebop.history import History from bebop.identity import load_identities from bebop.links import Links @@ -593,7 +593,7 @@ class Browser: def open_help(self): """Show the help page.""" - self.open_internal_page("help", HELP_PAGE) + self.open_internal_page("help", get_help(self.config)) def prompt(self, text, keys): """Display the text and allow it to type one of the given keys.""" diff --git a/bebop/help.py b/bebop/help.py index ec5528c..6c10e7e 100644 --- a/bebop/help.py +++ b/bebop/help.py @@ -46,4 +46,18 @@ with arguments by pressing the corresponding keybind above. * o/open : open this URL * forget_certificate : remove saved fingerprint for the hostname * q/quit: well, quit + +## Configuration + +The current configuration is: + +{config_list} """ + + +def get_help(config): + config_list = "\n".join( + f"* {key} = {value}" + for key, value in config.items() + ) + return HELP_PAGE.format(config_list=config_list)