#16 multiline shell commands #17 _ scope (global vs local) #18 path expansion (~) #19 nested commands trigger prompt2 #20 simplify backtick return value #21 prompt redesign #22 implicit interactive commands (drop ! prefix) #23 general cleanup and refactor
940 B
940 B
20 — Simplify backtick return value
Status: open
Currently backtick expressions return a table {code, stdout, stderr}, requiring verbose access:
!echo ${`ls`.stdout}
This is explicit but noisy for the common case. Consider making backticks return stdout directly, with the full result table still available via _:
-- backtick returns stdout string directly
local files = `ls`
-- full result still available in _
print(_.code)
print(_.stderr)
Considerations
-
This would be a breaking change to current backtick semantics
-
The table is still useful when you need exit code or stderr
-
Could we return multiple values?
stdout, result_table = \cmd`` -
How does this interact with pipelines where you chain results?
-
This would unify the interface/behaviour of backticks and ! commands, both set the majority of their data to
_ -
Main difference is where do they output their stdout & stderr