You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(repr.overrides): allow reprs to choose if they support certain behaviors
allow representations to choose to select a value for proper_pipes or
escape_args, to allow the user to swap between representations that may
or may not support or need these features easier.
Copy file name to clipboardExpand all lines: REPR.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,19 @@ local utils_json = tostring(sh.nixdoc {
34
34
- If you wish to make your `add_args` return something that is not a string, your other representation functions and any defined `transforms` must be able to handle that.
35
35
- In addition, if you wish to make your `add_args` return something that is not a string, you should define `__tostring` in its metatable to preserve useful error messages.
36
36
37
-
Our first 3 `Shelua.Repr` methods for `posix`: `arg_tbl`, `escape`, and `add_args`
37
+
Our first 3 `Shelua.Repr` methods for `posix`: `arg_tbl`, `escape`, and `add_args`, plus 2 extra override properties `proper_pipes` and `escape_args`
38
38
39
39
```lua
40
40
---@typeShelua.Repr
41
41
localposix= {
42
+
---Override top-level proper_pipes setting for this representation.
43
+
---Set with true or false, or use nil to fall back to top-level setting.
44
+
---@fieldproper_pipes? boolean
45
+
proper_pipes=nil,
46
+
---Override top-level escape_args setting for this representation.
47
+
---Set with true or false, or use nil to fall back to top-level setting.
48
+
---@fieldescape_args? boolean
49
+
escape_args=nil,
42
50
-- converts key and it's argument to "-k" or "-k=v" or "--key=v" or nil to ignore
43
51
-- turns table form args from table keys and values into flags
44
52
-- if returning a list, items will be added to args list in order
0 commit comments