[{"data":1,"prerenderedAt":1455,"buildId":1456},["ShallowReactive",2],{"docs:\u002Fintegrations\u002Fargument-parsers":3},{"page":4,"section":16,"document":17,"credits":10,"prev":1448,"next":1452},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":12,"layout":13,"sidebar":14,"toc":14,"kind":10,"group":10,"navigation":14,"order":15},"argument-parsers","\u002Fintegrations\u002Fargument-parsers","integrations\u002Fargument-parsers.md","Argument parsers","Use readerly with node:util parseArgs or cac. readerFlags takes the shared reader flags and hands the rest of argv to your parser.",null,[],"i-lucide-terminal","article",true,3,"integrations",{"nodes":18,"toc":1442},[19,32,40,43,72,104,146,165,187,193,202,652,679,686,714,733,742,748,822,851,856,862,1304,1328,1334,1353,1368,1377,1383,1434],[20,21,22,23,27,28,31],"p",{},"readerly is not a CLI framework. It reads the shared reader flags, such as ",[24,25,26],"code",{},"--format"," and ",[24,29,30],{},"--no-input",", and leaves your commands, options and help text to the parser you already use.",[33,34,39],"h2",{"id":35,"anchor":36},"two-calls-on-the-same-argv",{"label":37,"icon":38},"Section titled \"Two calls on the same argv\"","#","Two calls on the same argv",[20,41,42],{},"Each command takes its own arguments, the ones after its name, and uses them twice:",[44,45,46,63],"ol",{},[47,48,49,52,53,56,57,62],"li",{},[24,50,51],{},"createOut({ tool, command, argv })"," scans ",[24,54,55],{},"argv"," for the ",[58,59,61],"a",{"href":60},"\u002Fguide\u002Fflags","shared flags"," and builds the profile from them.",[47,64,65,68,69,71],{},[24,66,67],{},"readerFlags(argv).rest"," returns the same ",[24,70,55],{}," without those flags. Your parser reads that.",[20,73,74,77,78,81,82,84,85,88,89,92,93,96,97,99,100,103],{},[24,75,76],{},"readerFlags"," never throws. It stops at ",[24,79,80],{},"--"," and leaves ",[24,83,80],{}," and everything after it in ",[24,86,87],{},"rest",". It knows the long flags only, plus ",[24,90,91],{},"-y",". ",[24,94,95],{},"-v"," stays in ",[24,98,87],{},", so it can keep meaning ",[24,101,102],{},"--version",".",[20,105,106,107,109,110,109,113,109,116,109,119,109,122,109,125,109,127,109,130,109,133,109,135,109,138,141,142,145],{},"Your parser never sees ",[24,108,26],{},", ",[24,111,112],{},"--json",[24,114,115],{},"--full",[24,117,118],{},"--max-chars",[24,120,121],{},"--color",[24,123,124],{},"--no-color",[24,126,30],{},[24,128,129],{},"--non-interactive",[24,131,132],{},"--yes",[24,134,91],{},[24,136,137],{},"--verbose",[24,139,140],{},"--quiet"," or ",[24,143,144],{},"--input",". Don't declare options with those names.",[20,147,148,149,152,153,156,157,160,161,164],{},"A bad value, such as ",[24,150,151],{},"--format nope",", is not your parser's problem either. ",[24,154,155],{},"createOut"," keeps it and ",[24,158,159],{},"out.end()"," prints the failure and returns ",[24,162,163],{},"2",":",[166,167,170],"pre",{"language":168,"class":169,"wrap":14},"text","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,171,173,181,182],{"class":172},"language-text",[174,175,178],"span",{"class":176,"style":177},"line","display: inline",[174,179,180],{},"✖ --format nope is not a format. Use one of: text, agent, json, jsonl.","\n",[174,183,184],{"class":176,"style":177},[174,185,186],{},"╰▶ fix: Pass --format with one of: text, agent, json, jsonl.",[33,188,192],{"id":189,"anchor":190},"nodeutil-parseargs",{"label":191,"icon":38},"Section titled \"node:util parseArgs\"","node:util parseArgs",[20,194,195,198,199,164],{},[24,196,197],{},"parseArgs"," ships with Node, so this example needs nothing beyond ",[24,200,201],{},"readerly",[166,203,206],{"language":204,"filename":205,"class":169,"wrap":14},"ts","acme.ts",[24,207,209,181,229,181,243,181,245,181,289,181,329,181,337,181,345,181,359,181,369,181,386,181,397,181,402,181,413,181,454,181,459,181,497,181,526,181,540,181,570,181,583,181,588,181,590,181,625],{"class":208},"language-ts",[174,210,211,215,219,222,226],{"class":176,"style":177},[174,212,214],{"style":213},"color:#CF222E;--shiki-dark:#FF7B72","import",[174,216,218],{"style":217},"color:#1F2328;--shiki-dark:#E6EDF3"," { parseArgs } ",[174,220,221],{"style":213},"from",[174,223,225],{"style":224},"color:#0A3069;--shiki-dark:#A5D6FF"," \"node:util\"",[174,227,228],{"style":217},";",[174,230,231,233,236,238,241],{"class":176,"style":177},[174,232,214],{"style":213},[174,234,235],{"style":217}," { createOut, failure, FailureError, readerFlags } ",[174,237,221],{"style":213},[174,239,240],{"style":224}," \"readerly\"",[174,242,228],{"style":217},[174,244],{"class":176,"style":177},[174,246,247,250,253,256,260,263,266,268,272,275,277,280,283,286],{"class":176,"style":177},[174,248,249],{"style":213},"export",[174,251,252],{"style":213}," async",[174,254,255],{"style":213}," function",[174,257,259],{"style":258},"color:#8250DF;--shiki-dark:#D2A8FF"," check",[174,261,262],{"style":217},"(",[174,264,55],{"style":265},"color:#953800;--shiki-dark:#FFA657",[174,267,164],{"style":213},[174,269,271],{"style":270},"color:#0550AE;--shiki-dark:#79C0FF"," string",[174,273,274],{"style":217},"[])",[174,276,164],{"style":213},[174,278,279],{"style":265}," Promise",[174,281,282],{"style":217},"\u003C",[174,284,285],{"style":270},"number",[174,287,288],{"style":217},"> {",[174,290,291,294,297,300,303,306,309,311,314,317,320,323,326],{"class":176,"style":177},[174,292,293],{"style":213},"  const",[174,295,296],{"style":270}," out",[174,298,299],{"style":213}," =",[174,301,302],{"style":258}," createOut",[174,304,305],{"style":217},"\u003C{ ",[174,307,308],{"style":265},"files",[174,310,164],{"style":213},[174,312,313],{"style":270}," number",[174,315,316],{"style":217}," }>({ tool: ",[174,318,319],{"style":224},"\"acme\"",[174,321,322],{"style":217},", command: ",[174,324,325],{"style":224},"\"check\"",[174,327,328],{"style":217},", argv });",[174,330,331,334],{"class":176,"style":177},[174,332,333],{"style":213},"  let",[174,335,336],{"style":217}," parsed;",[174,338,339,342],{"class":176,"style":177},[174,340,341],{"style":213},"  try",[174,343,344],{"style":217}," {",[174,346,347,350,353,356],{"class":176,"style":177},[174,348,349],{"style":217},"    parsed ",[174,351,352],{"style":213},"=",[174,354,355],{"style":258}," parseArgs",[174,357,358],{"style":217},"({",[174,360,361,364,366],{"class":176,"style":177},[174,362,363],{"style":217},"      args: ",[174,365,76],{"style":258},[174,367,368],{"style":217},"(argv).rest,",[174,370,371,374,377,380,383],{"class":176,"style":177},[174,372,373],{"style":217},"      options: { fix: { type: ",[174,375,376],{"style":224},"\"boolean\"",[174,378,379],{"style":217},", default: ",[174,381,382],{"style":270},"false",[174,384,385],{"style":217}," } },",[174,387,388,391,394],{"class":176,"style":177},[174,389,390],{"style":217},"      allowPositionals: ",[174,392,393],{"style":270},"true",[174,395,396],{"style":217},",",[174,398,399],{"class":176,"style":177},[174,400,401],{"style":217},"    });",[174,403,404,407,410],{"class":176,"style":177},[174,405,406],{"style":217},"  } ",[174,408,409],{"style":213},"catch",[174,411,412],{"style":217}," (error) {",[174,414,415,418,421,424,426,429,432,434,437,439,442,445,448,451],{"class":176,"style":177},[174,416,417],{"style":213},"    return",[174,419,420],{"style":217}," out.",[174,422,423],{"style":258},"fail",[174,425,262],{"style":217},[174,427,428],{"style":213},"new",[174,430,431],{"style":258}," FailureError",[174,433,262],{"style":217},[174,435,436],{"style":258},"failure",[174,438,262],{"style":217},[174,440,441],{"style":224},"\"usage\"",[174,443,444],{"style":217},", (error ",[174,446,447],{"style":213},"as",[174,449,450],{"style":265}," Error",[174,452,453],{"style":217},").message)));",[174,455,456],{"class":176,"style":177},[174,457,458],{"style":217},"  }",[174,460,461,463,466,468,471,474,477,480,483,486,488,491,494],{"class":176,"style":177},[174,462,293],{"style":213},[174,464,465],{"style":270}," paths",[174,467,299],{"style":213},[174,469,470],{"style":217}," parsed.positionals.",[174,472,473],{"style":270},"length",[174,475,476],{"style":213}," >",[174,478,479],{"style":270}," 0",[174,481,482],{"style":213}," ?",[174,484,485],{"style":217}," parsed.positionals ",[174,487,164],{"style":213},[174,489,490],{"style":217}," [",[174,492,493],{"style":224},"\".\"",[174,495,496],{"style":217},"];",[174,498,499,502,505,508,511,514,517,520,523],{"class":176,"style":177},[174,500,501],{"style":217},"  out.",[174,503,504],{"style":258},"warn",[174,506,507],{"style":217},"({ code: ",[174,509,510],{"style":224},"\"ACME010\"",[174,512,513],{"style":217},", message: ",[174,515,516],{"style":224},"\"Alias shadows a workspace package\"",[174,518,519],{"style":217},", file: ",[174,521,522],{"style":224},"\"vite.config.ts\"",[174,524,525],{"style":217}," });",[174,527,528,530,533,536,538],{"class":176,"style":177},[174,529,501],{"style":217},[174,531,532],{"style":258},"set",[174,534,535],{"style":217},"({ files: paths.",[174,537,473],{"style":270},[174,539,525],{"style":217},[174,541,542,545,548,551,554,557,559,562,564,567],{"class":176,"style":177},[174,543,544],{"style":213},"  if",[174,546,547],{"style":217}," (",[174,549,550],{"style":213},"!",[174,552,553],{"style":217},"parsed.values.fix) out.",[174,555,556],{"style":258},"next",[174,558,262],{"style":217},[174,560,561],{"style":224},"\"acme check --fix\"",[174,563,109],{"style":217},[174,565,566],{"style":224},"\"applies 1 safe fix\"",[174,568,569],{"style":217},");",[174,571,572,575,577,580],{"class":176,"style":177},[174,573,574],{"style":213},"  return",[174,576,420],{"style":217},[174,578,579],{"style":258},"end",[174,581,582],{"style":217},"();",[174,584,585],{"class":176,"style":177},[174,586,587],{"style":217},"}",[174,589],{"class":176,"style":177},[174,591,592,595,597,600,602,605,608,611,613,616,619,621,623],{"class":176,"style":177},[174,593,594],{"style":213},"const",[174,596,490],{"style":217},[174,598,599],{"style":270},"command",[174,601,109],{"style":217},[174,603,604],{"style":213},"...",[174,606,607],{"style":270},"args",[174,609,610],{"style":217},"] ",[174,612,352],{"style":213},[174,614,615],{"style":217}," process.argv.",[174,617,618],{"style":258},"slice",[174,620,262],{"style":217},[174,622,163],{"style":270},[174,624,569],{"style":217},[174,626,627,630,633,636,639,642,644,647,649],{"class":176,"style":177},[174,628,629],{"style":213},"if",[174,631,632],{"style":217}," (command ",[174,634,635],{"style":213},"===",[174,637,638],{"style":224}," \"check\"",[174,640,641],{"style":217},") process.exitCode ",[174,643,352],{"style":213},[174,645,646],{"style":213}," await",[174,648,259],{"style":258},[174,650,651],{"style":217},"(args);",[20,653,654,657,658,660,661,664,665,109,668,664,671,27,674,664,676,103],{},[24,655,656],{},"process.exitCode = await check(args)"," sets the exit code and lets Node finish writing stdout. ",[24,659,159],{}," returns ",[24,662,663],{},"0"," for ",[24,666,667],{},"ok",[24,669,670],{},"1",[24,672,673],{},"failed",[24,675,163],{},[24,677,678],{},"action_required",[20,680,681,682,685],{},"In a pipe, ",[24,683,684],{},"acme check src"," prints:",[166,687,688],{"language":168,"class":169,"wrap":14},[24,689,690,181,695,181,700,181,705,181,709],{"class":172},[174,691,692],{"class":176,"style":177},[174,693,694],{},"⚠ 1 warning",[174,696,697],{"class":176,"style":177},[174,698,699],{},"",[174,701,702],{"class":176,"style":177},[174,703,704],{},"warn  ACME010  vite.config.ts  Alias shadows a workspace package",[174,706,707],{"class":176,"style":177},[174,708,699],{},[174,710,711],{"class":176,"style":177},[174,712,713],{},"next: acme check --fix   (applies 1 safe fix)",[20,715,716,718,719,722,723,726,727,92,729,732],{},[24,717,197],{}," is strict by default and throws on an unknown option. Wrapped in ",[24,720,721],{},"failure(\"usage\", …)",", the error leaves through ",[24,724,725],{},"out.fail"," in the reader's format and exits ",[24,728,163],{},[24,730,731],{},"acme check src --frobnicate"," prints on stderr:",[166,734,735],{"language":168,"class":169,"wrap":14},[24,736,737],{"class":172},[174,738,739],{"class":176,"style":177},[174,740,741],{},"✖ Unknown option '--frobnicate'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- \"--frobnicate\"",[20,743,744,745,747],{},"With ",[24,746,112],{},", the same failure is a document on stdout:",[166,749,751],{"language":750,"class":169,"wrap":14},"json",[24,752,754,181,759,181,773,181,785,181,793,181,814,181,818],{"class":753},"language-json",[174,755,756],{"class":176,"style":177},[174,757,758],{"style":217},"{",[174,760,761,765,768,771],{"class":176,"style":177},[174,762,764],{"style":763},"color:#116329;--shiki-dark:#7EE787","  \"schema\"",[174,766,767],{"style":217},": ",[174,769,770],{"style":224},"\"acme.check\u002Fv1\"",[174,772,396],{"style":217},[174,774,775,778,780,783],{"class":176,"style":177},[174,776,777],{"style":763},"  \"status\"",[174,779,767],{"style":217},[174,781,782],{"style":224},"\"failed\"",[174,784,396],{"style":217},[174,786,787,790],{"class":176,"style":177},[174,788,789],{"style":763},"  \"error\"",[174,791,792],{"style":217},": {",[174,794,795,798,800,803,806,809,811],{"class":176,"style":177},[174,796,797],{"style":763},"    \"message\"",[174,799,767],{"style":217},[174,801,802],{"style":224},"\"Unknown option '--frobnicate'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ",[174,804,805],{"style":213},"\\\"",[174,807,808],{"style":224},"--frobnicate",[174,810,805],{"style":213},[174,812,813],{"style":224},"\"",[174,815,816],{"class":176,"style":177},[174,817,458],{"style":217},[174,819,820],{"class":176,"style":177},[174,821,587],{"style":217},[823,824,827],"github-callout",{"type":825,"title":826},"warning","Warning",[20,828,829,832,833,836,837,840,841,844,845,848,849,103],{},[24,830,831],{},"out.fail(error)"," takes something thrown. Pass ",[24,834,835],{},"new FailureError(failure(…))",", not the ",[24,838,839],{},"Failure"," object itself: a plain object becomes a ",[24,842,843],{},"runtime"," failure with the message ",[24,846,847],{},"[object Object]"," and exit ",[24,850,670],{},[33,852,853],{"id":853,"anchor":854},"cac",{"label":855,"icon":38},"Section titled \"cac\"",[20,857,858,859,861],{},"cac matches the command for you, so the command's own arguments come from ",[24,860,55],{}," without the command's name. This example ran with cac 7.1.1:",[166,863,864],{"language":204,"filename":205,"class":169,"wrap":14},[24,865,866,181,880,181,892,181,894,181,942,181,963,181,1015,181,1025,181,1029,181,1031,181,1050,181,1068,181,1073,181,1093,181,1112,181,1118,181,1154,181,1182,181,1187,181,1218,181,1225,181,1242,181,1251,181,1268,181,1300],{"class":208},[174,867,868,870,873,875,878],{"class":176,"style":177},[174,869,214],{"style":213},[174,871,872],{"style":217}," { cac } ",[174,874,221],{"style":213},[174,876,877],{"style":224}," \"cac\"",[174,879,228],{"style":217},[174,881,882,884,886,888,890],{"class":176,"style":177},[174,883,214],{"style":213},[174,885,235],{"style":217},[174,887,221],{"style":213},[174,889,240],{"style":224},[174,891,228],{"style":217},[174,893],{"class":176,"style":177},[174,895,896,899,901,903,905,907,909,911,914,917,919,921,923,926,928,931,934,936,939],{"class":176,"style":177},[174,897,898],{"style":213},"async",[174,900,255],{"style":213},[174,902,259],{"style":258},[174,904,262],{"style":217},[174,906,55],{"style":265},[174,908,164],{"style":213},[174,910,271],{"style":270},[174,912,913],{"style":217},"[], ",[174,915,916],{"style":265},"paths",[174,918,164],{"style":213},[174,920,271],{"style":270},[174,922,913],{"style":217},[174,924,925],{"style":265},"options",[174,927,164],{"style":213},[174,929,930],{"style":217}," { ",[174,932,933],{"style":265},"fix",[174,935,164],{"style":213},[174,937,938],{"style":270}," boolean",[174,940,941],{"style":217}," }) {",[174,943,944,946,948,950,952,955,957,959,961],{"class":176,"style":177},[174,945,293],{"style":213},[174,947,296],{"style":270},[174,949,299],{"style":213},[174,951,302],{"style":258},[174,953,954],{"style":217},"({ tool: ",[174,956,319],{"style":224},[174,958,322],{"style":217},[174,960,325],{"style":224},[174,962,328],{"style":217},[174,964,965,967,970,972,975,977,979,982,984,987,990,993,996,998,1000,1002,1004,1007,1010,1013],{"class":176,"style":177},[174,966,501],{"style":217},[174,968,969],{"style":258},"info",[174,971,262],{"style":217},[174,973,974],{"style":224},"`checked ${",[174,976,916],{"style":217},[174,978,103],{"style":224},[174,980,981],{"style":258},"join",[174,983,262],{"style":224},[174,985,986],{"style":224},"\", \"",[174,988,989],{"style":224},") ",[174,991,992],{"style":213},"||",[174,994,995],{"style":224}," \".\"}${",[174,997,925],{"style":217},[174,999,103],{"style":224},[174,1001,933],{"style":217},[174,1003,482],{"style":213},[174,1005,1006],{"style":224}," \" with fixes\"",[174,1008,1009],{"style":213}," :",[174,1011,1012],{"style":224}," \"\"}`",[174,1014,569],{"style":217},[174,1016,1017,1019,1021,1023],{"class":176,"style":177},[174,1018,574],{"style":213},[174,1020,420],{"style":217},[174,1022,579],{"style":258},[174,1024,582],{"style":217},[174,1026,1027],{"class":176,"style":177},[174,1028,587],{"style":217},[174,1030],{"class":176,"style":177},[174,1032,1033,1035,1038,1040,1042,1044,1046,1048],{"class":176,"style":177},[174,1034,594],{"style":213},[174,1036,1037],{"style":270}," argv",[174,1039,299],{"style":213},[174,1041,615],{"style":217},[174,1043,618],{"style":258},[174,1045,262],{"style":217},[174,1047,163],{"style":270},[174,1049,569],{"style":217},[174,1051,1052,1054,1057,1059,1062,1064,1066],{"class":176,"style":177},[174,1053,594],{"style":213},[174,1055,1056],{"style":270}," cli",[174,1058,299],{"style":213},[174,1060,1061],{"style":258}," cac",[174,1063,262],{"style":217},[174,1065,319],{"style":224},[174,1067,569],{"style":217},[174,1069,1070],{"class":176,"style":177},[174,1071,1072],{"style":217},"cli",[174,1074,1075,1078,1080,1082,1085,1087,1090],{"class":176,"style":177},[174,1076,1077],{"style":217},"  .",[174,1079,599],{"style":258},[174,1081,262],{"style":217},[174,1083,1084],{"style":224},"\"check [...paths]\"",[174,1086,109],{"style":217},[174,1088,1089],{"style":224},"\"Check files\"",[174,1091,1092],{"style":217},")",[174,1094,1095,1097,1100,1102,1105,1107,1110],{"class":176,"style":177},[174,1096,1077],{"style":217},[174,1098,1099],{"style":258},"option",[174,1101,262],{"style":217},[174,1103,1104],{"style":224},"\"--fix\"",[174,1106,109],{"style":217},[174,1108,1109],{"style":224},"\"Apply the safe fixes\"",[174,1111,1092],{"style":217},[174,1113,1114],{"class":176,"style":177},[174,1115,1117],{"style":1116},"color:#6E7781;--shiki-dark:#8B949E","  \u002F\u002F createOut gets the command's own arguments: argv without the word `check`.",[174,1119,1120,1122,1125,1128,1130,1132,1134,1136,1138,1140,1142,1144,1146,1148,1151],{"class":176,"style":177},[174,1121,1077],{"style":217},[174,1123,1124],{"style":258},"action",[174,1126,1127],{"style":217},"((",[174,1129,916],{"style":265},[174,1131,164],{"style":213},[174,1133,271],{"style":270},[174,1135,913],{"style":217},[174,1137,925],{"style":265},[174,1139,164],{"style":213},[174,1141,930],{"style":217},[174,1143,933],{"style":265},[174,1145,164],{"style":213},[174,1147,938],{"style":270},[174,1149,1150],{"style":217}," }) ",[174,1152,1153],{"style":213},"=>",[174,1155,1156,1159,1162,1165,1167,1170,1172,1174,1177,1179],{"class":176,"style":177},[174,1157,1158],{"style":258},"    check",[174,1160,1161],{"style":217},"(argv.",[174,1163,1164],{"style":258},"toSpliced",[174,1166,1161],{"style":217},[174,1168,1169],{"style":258},"indexOf",[174,1171,262],{"style":217},[174,1173,325],{"style":224},[174,1175,1176],{"style":217},"), ",[174,1178,670],{"style":270},[174,1180,1181],{"style":217},"), paths, options),",[174,1183,1184],{"class":176,"style":177},[174,1185,1186],{"style":217},"  );",[174,1188,1189,1192,1195,1198,1201,1203,1205,1207,1209,1211,1214,1216],{"class":176,"style":177},[174,1190,1191],{"style":217},"cli.",[174,1193,1194],{"style":258},"parse",[174,1196,1197],{"style":217},"([",[174,1199,1200],{"style":224},"\"node\"",[174,1202,109],{"style":217},[174,1204,319],{"style":224},[174,1206,109],{"style":217},[174,1208,604],{"style":213},[174,1210,76],{"style":258},[174,1212,1213],{"style":217},"(argv).rest], { run: ",[174,1215,382],{"style":270},[174,1217,525],{"style":217},[174,1219,1220,1223],{"class":176,"style":177},[174,1221,1222],{"style":213},"try",[174,1224,344],{"style":217},[174,1226,1227,1230,1232,1234,1237,1240],{"class":176,"style":177},[174,1228,1229],{"style":217},"  process.exitCode ",[174,1231,352],{"style":213},[174,1233,646],{"style":213},[174,1235,1236],{"style":217}," cli.",[174,1238,1239],{"style":258},"runMatchedCommand",[174,1241,582],{"style":217},[174,1243,1244,1247,1249],{"class":176,"style":177},[174,1245,1246],{"style":217},"} ",[174,1248,409],{"style":213},[174,1250,412],{"style":217},[174,1252,1253,1255,1257,1259,1261,1263,1265],{"class":176,"style":177},[174,1254,293],{"style":213},[174,1256,296],{"style":270},[174,1258,299],{"style":213},[174,1260,302],{"style":258},[174,1262,954],{"style":217},[174,1264,319],{"style":224},[174,1266,1267],{"style":217},", command: cli.matchedCommandName, argv });",[174,1269,1270,1272,1274,1276,1278,1280,1282,1284,1286,1288,1290,1292,1294,1296,1298],{"class":176,"style":177},[174,1271,1229],{"style":217},[174,1273,352],{"style":213},[174,1275,420],{"style":217},[174,1277,423],{"style":258},[174,1279,262],{"style":217},[174,1281,428],{"style":213},[174,1283,431],{"style":258},[174,1285,262],{"style":217},[174,1287,436],{"style":258},[174,1289,262],{"style":217},[174,1291,441],{"style":224},[174,1293,444],{"style":217},[174,1295,447],{"style":213},[174,1297,450],{"style":265},[174,1299,453],{"style":217},[174,1301,1302],{"class":176,"style":177},[174,1303,587],{"style":217},[20,1305,1306,1309,1310,1313,1314,92,1317,1320,1321,1323,1324,1327],{},[24,1307,1308],{},"cli.parse"," drops the first two items of the array it gets, as it does with ",[24,1311,1312],{},"process.argv",", hence ",[24,1315,1316],{},"\"node\", \"acme\"",[24,1318,1319],{},"{ run: false }"," keeps the action from running inside ",[24,1322,1194],{},", so ",[24,1325,1326],{},"runMatchedCommand()"," can return its exit code.",[20,1329,1330,1331,685],{},"Reader flags work before or after the command name. ",[24,1332,1333],{},"acme --format jsonl check src",[166,1335,1336],{"language":168,"class":169,"wrap":14},[24,1337,1338,181,1343,181,1348],{"class":172},[174,1339,1340],{"class":176,"style":177},[174,1341,1342],{},"{\"type\":\"version\",\"schema\":\"acme.check\u002Fv1\",\"tool\":\"acme\"}",[174,1344,1345],{"class":176,"style":177},[174,1346,1347],{},"{\"type\":\"diagnostic\",\"severity\":\"info\",\"message\":\"checked src\"}",[174,1349,1350],{"class":176,"style":177},[174,1351,1352],{},"{\"type\":\"result\",\"status\":\"ok\",\"message\":\"1 info\",\"data\":{}}",[20,1354,1355,1356,1358,1359,1361,1362,1365,1366,164],{},"cac throws on an unknown option from ",[24,1357,1326],{},", before the action runs. The ",[24,1360,409],{}," turns it into a usage failure. ",[24,1363,1364],{},"acme check --frobnicate"," prints on stderr and exits ",[24,1367,163],{},[166,1369,1370],{"language":168,"class":169,"wrap":14},[24,1371,1372],{"class":172},[174,1373,1374],{"class":176,"style":177},[174,1375,1376],{},"✖ Unknown option `--frobnicate`",[33,1378,1382],{"id":1379,"anchor":1380},"the-rerun-command",{"label":1381,"icon":38},"Section titled \"The rerun command\"","The rerun command",[20,1384,1385,1386,1389,1390,1393,1394,1397,1398,1400,1401,109,1404,27,1406,1408,1409,1411,1412,1414,1415,1418,1419,1422,1423,1426,1427,1430,1431,103],{},"readerly builds the commands in ",[24,1387,1388],{},"hidden:"," footers, in the ",[24,1391,1392],{},"next:"," line of a skipped prompt and in the ",[24,1395,1396],{},"rerun"," of an ",[24,1399,678],{}," failure from ",[24,1402,1403],{},"tool",[24,1405,599],{},[24,1407,87],{},", without the reader flags. Pass the command's own arguments, not the whole ",[24,1410,1312],{},". For ",[24,1413,684],{}," with ",[24,1416,1417],{},"argv: [\"src\"]",", a skipped ",[24,1420,1421],{},"--fix"," prompt prints ",[24,1424,1425],{},"next: acme check src --fix",". With ",[24,1428,1429],{},"argv: [\"check\", \"src\"]",", it prints ",[24,1432,1433],{},"next: acme check check src --fix",[20,1435,1436,1437,1441],{},"Next: ",[58,1438,1440],{"href":1439},"\u002Fintegrations\u002Ftesting","testing your CLI"," for every reader.",[1443,1445,1446,1447],{"id":35,"depth":1444,"text":39},2,{"id":189,"depth":1444,"text":192},{"id":853,"depth":1444,"text":853},{"id":1379,"depth":1444,"text":1382},{"path":1449,"title":1450,"description":1451},"\u002Fintegrations\u002Fgithub-actions","GitHub Actions","How readerly detects GitHub Actions, prints text with file annotations on stderr, escapes them, caps them at 10, and what agents in CI get instead.",{"path":1439,"title":1453,"description":1454},"Testing your CLI","Test one readerly command as a terminal, a coding agent, GitHub Actions and --format json with a fake Io, prompts answered, and golden files per reader.",1795985395250,"22ea5d7b-bce0-4e3b-bca3-1fbe3722fcf7"]