Files
marqdo/tests/lib/cli-sort-smoke.mq.md
T
cflmyandCursor 7d86ed1d9c feat(stdlib): Mid M5 list algorithms and cli.parse
Thicken table with sort/unique/chunk/zip/flatten and add lib/cli
flag parsing, with golds and public demos.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 20:32:58 +08:00

23 lines
531 B
Markdown

---
title: table sort_by + cli
import table:lib/table.mq.md
import csv:lib/csv.mq.md
import cli:lib/cli.mq.md
---
# main
*raw = "name,score\nbob,2\nalice,10\n"*
*rows = > csv.parse text=`raw`*
*rows = > table.sort_by list=`rows` key="name"*
*r0 = > at value=`rows` index=0*
> print text=`r0`[^name]
*args = > split value="--input,data.csv,rest,--verbose" sep=","*
*flags = > cli.parse args=`args`*
> print text=`flags`[^input]
> print text=`flags`[^verbose]
*pos = `flags`[^_]*
*p0 = > at value=`pos` index=0*
> print text=`p0`