Skip to content

Commit f9f63ca

Browse files
committed
config: add columns entry
1 parent 0d7357f commit f9f63ca

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ v4.6.0
1111
* The default value for ``path`` is now ``~/calendars/*``. Previously this
1212
value was required. This change is non-breaking; all existing valid
1313
configurations define this value.
14-
* Add a new `columns` option to enable column-aligned output.
14+
* Add a new `columns` option and configuration entry to enable column-aligned
15+
output.
1516

1617
v4.5.0
1718
------

config.py.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# A glob expression which matches all directories relevant.
22
path = "~/my_calendars/*"
3+
columns = "auto" # never (default) / always / auto
34
date_format = "%Y-%m-%d"
45
time_format = "%H:%M"
56
default_list = "Personal"

todoman/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ def cli(
375375
elif colour == "never":
376376
click_ctx.color = False
377377

378+
columns = columns or ctx.config["columns"]
378379
if columns == "auto":
379380
ctx.columns = isinstance(sys.stdout, io.TextIOBase) and sys.stdout.isatty()
380381
else:

todoman/configuration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ class ConfigEntry(NamedTuple):
8282
By default todoman will disable colored output if stdout is not a TTY (value
8383
``auto``). Set to ``never`` to disable colored output entirely, or ``always``
8484
to enable it regardless. This can be overridden with the ``--color`` option.
85+
""",
86+
validate_color_config,
87+
),
88+
ConfigEntry(
89+
"columns",
90+
str,
91+
"auto",
92+
"""
93+
By default todoman will disable column-aligned output entirely (value
94+
`never`). Set to `auto` to enable column-aligned output if stdout is a TTY,
95+
or `always` to enable it regardless. This can be overridden with the
96+
``--columns`` option.
8597
""",
8698
validate_color_config,
8799
),

0 commit comments

Comments
 (0)