From 56f1b7d713d944bc073ffc17d0019c4b4252b427 Mon Sep 17 00:00:00 2001 From: Saul Pwanson Date: Sat, 4 Nov 2023 23:41:15 -0700 Subject: [PATCH] [help] add titles to HELPTODO stubs --- visidata/aggregators.py | 2 +- visidata/color.py | 2 +- visidata/features/join.py | 3 +++ visidata/path.py | 4 ++-- visidata/search.py | 18 +++++++++--------- visidata/text_source.py | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/visidata/aggregators.py b/visidata/aggregators.py index 03409b0ed..15b0dca1f 100644 --- a/visidata/aggregators.py +++ b/visidata/aggregators.py @@ -7,7 +7,7 @@ from visidata import Progress, Sheet, Column, ColumnsSheet, VisiData from visidata import vd, anytype, vlen, asyncthread, wrapply, AttrDict -vd.help_aggregators = 'HELPTODO' +vd.help_aggregators = '# Aggregators Help\nHELPTODO' vd.option('null_value', None, 'a value to be counted as null', replay=True) diff --git a/visidata/color.py b/visidata/color.py index 204f577aa..166d8f938 100644 --- a/visidata/color.py +++ b/visidata/color.py @@ -9,7 +9,7 @@ __all__ = ['ColorAttr', 'colors', 'update_attr', 'ColorMaker', 'rgb_to_attr'] -vd.help_color = 'HELPTODO' +vd.help_color = '# Color Help\nHELPTODO' @dataclass diff --git a/visidata/features/join.py b/visidata/features/join.py index ba23f6c9b..4bf2a8d32 100644 --- a/visidata/features/join.py +++ b/visidata/features/join.py @@ -5,6 +5,8 @@ from visidata import vd, VisiData, asyncthread, Sheet, Progress, IndexSheet, Column, CellColorizer, ColumnItem, SubColumnItem, TypedWrapper, ColumnsSheet, AttrDict +vd.help_join = '# Join Help\nHELPTODO' + @VisiData.api def ensureLoaded(vd, sheets): threads = [vs.ensureLoaded() for vs in sheets] @@ -364,6 +366,7 @@ def _fmt_aggr_summary(match, row, trigger_key): vd.jointypes, value_key='key', formatter=_fmt_aggr_summary, + help=vd.help_join, type='jointype') diff --git a/visidata/path.py b/visidata/path.py index a33072290..67cb4541e 100644 --- a/visidata/path.py +++ b/visidata/path.py @@ -10,8 +10,8 @@ from visidata import vd from visidata import VisiData, Progress -vd.help_encoding = 'HELPTODO' -vd.help_encoding_errors = 'HELPTODO' +vd.help_encoding = '# Encoding\nHELPTODO' +vd.help_encoding_errors = '# Encoding Errors\nHELPTODO' vd.option('encoding', 'utf-8-sig', 'encoding passed to codecs.open when reading a file', replay=True, help=vd.help_encoding) vd.option('encoding_errors', 'surrogateescape', 'encoding_errors passed to codecs.open', replay=True, help=vd.help_encoding_errors) diff --git a/visidata/search.py b/visidata/search.py index 7da727a1c..89c27d504 100644 --- a/visidata/search.py +++ b/visidata/search.py @@ -3,6 +3,15 @@ VisiData.init('searchContext', dict) # [(regex, columns, backward)] -> kwargs from previous search +vd.help_regex_flags = '''# regex flags +- `A` (ASCII) ASCII-only matching (not unicode) +- `I` (IGNORECASE): case-insensitive matching +- `M` (MULTILINE): `^` and `$` match after/before newlines +- `S` (DOTALL): `.` match any character at all, including newline +- `X` (VERBOSE): allow verbose regex +''' + + @VisiData.api @asyncthread def moveRegex(vd, sheet, *args, **kwargs): @@ -61,15 +70,6 @@ def findMatchingColumn(sheet, row, columns, func): vd.status('%s matches for /%s/' % (matchingRowIndexes, regex.pattern)) -vd.help_regex_flags = '''# regex flags - -- `A` (ASCII) ASCII-only matching (not unicode) -- `I` (IGNORECASE): case-insensitive matching -- `M` (MULTILINE): `^` and `$` match after/before newlines -- `S` (DOTALL): `.` match any character at all, including newline -- `X` (VERBOSE): allow verbose regex -''' - @Sheet.api def searchInputRegex(sheet, action:str, columns:str='cursorCol'): r = vd.inputMultiple(regex=dict(prompt=f"{action} regex: ", type="regex", defaultLast=True, help=vd.help_regex), diff --git a/visidata/text_source.py b/visidata/text_source.py index 5933024e8..129f3e74f 100644 --- a/visidata/text_source.py +++ b/visidata/text_source.py @@ -2,7 +2,7 @@ from visidata import vd, BaseSheet -vd.help_regex = 'HELPTODO' +vd.help_regex = '# Regex Help\nHELPTODO' vd.option('regex_skip', '', 'regex of lines to skip in text sources', help=vd.help_regex)