Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | util.human.io: Don't accept ambiguous durations by default | Matthew Wild | 2023-11-30 | 1 | -3/+17 |
| | | | | | The new method parse_duration_lax() exports the old behaviour, mainly for compatibility purposes. | ||||
* | util.human.io: Fix stray 'stty' error by only querying width of real ttys | Kim Alvefur | 2023-07-16 | 1 | -0/+4 |
| | | | | | This adds a dependency on a binary and *nix-specific module but then stty is probably *nix-specific anyway so maybe that's fine. | ||||
* | util.human.io: Fix pattern in parse_duration() to cover all used letters | Kim Alvefur | 2023-07-16 | 1 | -2/+2 |
| | | | | | Notably 'h' was missing. Awkwardly, 'hour' would result in 'ho' which was missing from table. | ||||
* | util.human.io: Fix column width miscalculation | Kim Alvefur | 2023-04-09 | 1 | -3/+0 |
| | | | | | | Fixes that the more fixed width columns there are, the narrower the resulting table becomes. A right-aligned variable-width column at the last position should always be flush to the right side of the terminal. | ||||
* | util.human.io: Fix error with ellipsis to negative length | Kim Alvefur | 2023-04-09 | 1 | -1/+1 |
| | | | | | Can happen if you resize the terminal too narrow that the space left for variable width columns end up negative. | ||||
* | util.human.io: Add parse_duration() method to parse a duration string | Matthew Wild | 2023-04-07 | 1 | -0/+12 |
| | | | | | Similar logic occurs throughout various modules in the codebase. We might even want a module:get_option_duration()?? | ||||
* | util.human.io: Coerce $COLUMNS to number | Kim Alvefur | 2023-04-07 | 1 | -1/+1 |
| | | | | os.getenv() returns a string but term_width() should return a number | ||||
* | util.human.io: table: don't read $COLUMNS directly, just use term_width() | Matthew Wild | 2023-04-07 | 1 | -1/+1 |
| | | | | ...which now reads $COLUMNS for us and does the right thing. | ||||
* | util.human.io: table: Return determined width as a second result | Matthew Wild | 2023-04-07 | 1 | -1/+1 |
| | | | | | This allows callers to adjust other things based on the width of the rows (such as header lines). | ||||
* | util.human.io: Prefer using the $COLUMNS environment variable if set (by ↵ | Kim Alvefur | 2023-04-07 | 1 | -0/+2 |
| | | | | | | readline) Feels like it should be faster. | ||||
* | util.human.io: table: use term_width() to discover terminal width | Matthew Wild | 2023-04-07 | 1 | -1/+1 |
| | |||||
* | util.human.io: Add term_width() method to discover the terminal width | Matthew Wild | 2023-04-07 | 1 | -0/+12 |
| | | | | | This is not standard POSIX, but apparently very widely supported. For reference: https://www.austingroupbugs.net/view.php?id=1053 | ||||
* | util.human.io: Pass the whole column definition to mapper function | Kim Alvefur | 2023-04-07 | 1 | -1/+1 |
| | | | | | | I forget why I wanted this, but it may allow doing things like pull settings from the column, especially when the mapper function is reused among many columns. | ||||
* | util.human.io: Allow defining per column ellipsis function | Kim Alvefur | 2023-04-07 | 1 | -1/+1 |
| | | | | | | As an alternative to doing it in the mapper function. Could be useful in cases where one may want to put the ellipsis in the middle or beginning instead of the start. | ||||
* | util.human.io: Pass expected width to mapper function | Kim Alvefur | 2023-04-07 | 1 | -1/+1 |
| | | | | | In order to allow it to adjust its output to available space, apply its own ellipsis method or other compacting method. | ||||
* | util.human.io: Fix pattern to support fractional proportions | Matthew Wild | 2023-04-06 | 1 | -2/+2 |
| | |||||
* | util.human.io: Support for dynamic "proportional" columns | Matthew Wild | 2023-04-06 | 1 | -4/+14 |
| | | | | | | | | Instead of a percentage, this allows you to specify e.g. `width="[N]p"`, where a width="2p" will be twice the width of a width="1p" column. Compatibility with the old %-based widths is preserved, and percentages adding up to more than 100 are handled more gracefully. | ||||
* | util: Prefix module imports with prosody namespace | Kim Alvefur | 2023-03-17 | 1 | -2/+2 |
| | |||||
* | util.human.io: Fix handling of os.execute() return values in Lua 5.2+ | Kim Alvefur | 2022-10-20 | 1 | -3/+3 |
| | | | | Wrong part of Lua 5.1 compat removed in 0f4feaf9ca64 | ||||
* | compat: Remove handling of Lua 5.1 location of 'unpack' function | Kim Alvefur | 2022-07-11 | 1 | -1/+1 |
| | |||||
* | util: Remove various Lua 5.1 compatibility hacks | Kim Alvefur | 2022-07-02 | 2 | -12/+1 |
| | | | | Part of #1600 | ||||
* | util.human.io: Use UTF-8-aware length check in padding functions | Kim Alvefur | 2021-11-12 | 1 | -2/+2 |
| | |||||
* | util.human.io: Fix cutting of UTF-8 into pieces | Kim Alvefur | 2021-11-12 | 1 | -7/+21 |
| | | | | Down the rabbit hole we go... | ||||
* | util.human.io: Trim any broken UTF-8 from ellipsis | Kim Alvefur | 2021-11-12 | 1 | -1/+5 |
| | | | | | | | This should fix basic problems with multi-byte UTF-8 sequences getting cut in the middle. Down the rabbit hole we go... | ||||
* | util.human.io: Factor out ellipsis function | Kim Alvefur | 2021-11-12 | 1 | -1/+6 |
| | | | | Could be useful elsewhere | ||||
* | util.human.io: Support specifying column defaults in tables | Kim Alvefur | 2021-11-12 | 1 | -1/+1 |
| | |||||
* | util.human.io: Pass nil to cell mapper to signal missing value | Kim Alvefur | 2021-11-12 | 1 | -1/+9 |
| | | | | | Seems more like conventional Lua than passing an empty string to signal lack of value. | ||||
* | util.human.io: Fix right-alignment | Kim Alvefur | 2020-06-06 | 1 | -1/+1 |
| | |||||
* | util.human.io.table: Allow a map callaback per column | Kim Alvefur | 2020-06-04 | 1 | -1/+1 |
| | | | | | | This allows e.g. mapping booleans to "yes" or "no", specific number formatting or generating virtual columns. All while not mutating the underlying data or creating additional temporary tables. | ||||
* | util.human.io: Consider separator when calculating remaining width | Kim Alvefur | 2020-06-04 | 1 | -0/+3 |
| | |||||
* | util.human.io: Use literal ellipsis instead of \u escape | Kim Alvefur | 2020-06-04 | 1 | -1/+1 |
| | | | | For compat with Lua 5.2 and before | ||||
* | util.human.io: Replace overflow with ellipsis | Kim Alvefur | 2020-06-04 | 1 | -1/+3 |
| | |||||
* | util.human.io: Draw a separator between columns | Kim Alvefur | 2020-06-04 | 1 | -2/+3 |
| | |||||
* | util.human.io: Remove padding option and use $COLUMNS as default width | Matthew Wild | 2020-06-04 | 1 | -4/+3 |
| | |||||
* | util.human.units: Factor out function for getting multiplier | Kim Alvefur | 2020-06-04 | 1 | -9/+15 |
| | |||||
* | util.human.io: table: Fix title printing when columns use named keys | Matthew Wild | 2020-06-04 | 1 | -2/+3 |
| | |||||
* | util.human.io: table: Return title row when no row data passed | Matthew Wild | 2020-06-03 | 1 | -0/+5 |
| | |||||
* | util.human.io: table: switch row function to simply returning prepared row ↵ | Matthew Wild | 2020-06-03 | 1 | -5/+6 |
| | | | | string | ||||
* | util.human.io: Add padleft, padright and a table printing function | Matthew Wild | 2020-06-03 | 1 | -0/+53 |
| | |||||
* | util.human.units: Handle lack of math.log(n, base) on Lua 5.1 | Kim Alvefur | 2020-06-03 | 1 | -0/+8 |
| | |||||
* | util.human.units: Put math functions into locals | Kim Alvefur | 2020-06-03 | 1 | -3/+9 |
| | | | | | Primarily because the next commit will deal with math.log behaving differently on Lua 5.1 and that's eaiser with locals. | ||||
* | util.human.units: Handle location of unpack() in Lua 5.1 | Kim Alvefur | 2020-06-03 | 1 | -1/+3 |
| | |||||
* | util.human.units: A library for formatting numbers with SI units | Kim Alvefur | 2019-01-04 | 1 | -0/+58 |
| | |||||
* | util.human.io: Fix variable name [luacheck] | Matthew Wild | 2020-06-02 | 1 | -1/+1 |
| | |||||
* | util.human.io: New central place for UI helpers | Matthew Wild | 2020-06-02 | 1 | -0/+96 |