elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.53k stars 297 forks source link

document capturing multiline command output #1720

Open eMBee opened 10 months ago

eMBee commented 10 months ago

files = (ls)

results in an error:

Exception: arity mismatch: assignment right-hand-side must be 1 value, but is 13 values

it took some guessing to figure out that the correct way seems to be:

files = [(ls)]

an example of this could probably be added to https://elv.sh/ref/language.html#output-capture with a reference to https://elv.sh/ref/language.html#list where it could also be mentioned.

both would make this example easier to discover and understand

krader1961 commented 6 months ago

FYI, This is documented at https://elv.sh/learn/effective-elvish.html#working-with-multiple-values, but would benefit from a mention in the output capture portion of the documentation. I don't think this should be mentioned in the list reference documentation. Exactly how best to improve the documentation is an open question. For example, should the text at https://elv.sh/learn/effective-elvish.html#working-with-multiple-values be moved to https://elv.sh/ref/language.html#output-capture? Or should a reference to the former be added to the latter? Something else?