[{"data":1,"prerenderedAt":1169},["ShallowReactive",2],{"page-\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fgenerating-man-pages-and-docs-from-a-cli\u002F":3,"content-directory":921},{"id":4,"title":5,"body":6,"date":905,"description":906,"difficulty":907,"draft":908,"extension":909,"meta":910,"navigation":634,"path":911,"seo":912,"stem":913,"tags":914,"updated":905,"__hash__":920},"content\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fgenerating-man-pages-and-docs-from-a-cli\u002Findex.md","Generating Man Pages and Docs from a CLI",{"type":7,"value":8,"toc":883},"minimark",[9,13,18,73,77,90,94,98,101,148,151,172,204,227,230,234,237,240,283,286,289,293,296,299,305,366,379,385,391,445,449,456,459,492,495,499,509,515,528,534,538,541,751,754,758,761,765,770,773,777,784,788,798,802,805,809,812,816,827,831,834,838,841,845,879],[10,11,12],"p",{},"Reference documentation retyped into a README is wrong within one release. The command tree already\nknows every command, option, default and help string, so the reference should be generated from it\n— and the only interesting question is how to stop the generated copy drifting from the code.",[14,15,17],"h2",{"id":16},"tldr","TL;DR",[19,20,21,37,45,59,62],"ul",{},[22,23,24,28,29,32,33,36],"li",{},[25,26,27],"code",{},"typer mytool.cli utils docs"," generates markdown; ",[25,30,31],{},"click-man"," and ",[25,34,35],{},"sphinx-click"," cover Click.",[22,38,39,40,44],{},"Generate into the repository, ",[41,42,43],"strong",{},"commit the result",", and fail CI when regenerating changes it.",[22,46,47,48,51,52,51,55,58],{},"A man page needs sections the generator does not know: ",[41,49,50],{},"EXIT STATUS",", ",[41,53,54],{},"ENVIRONMENT",[41,56,57],{},"FILES",".",[22,60,61],{},"Install man pages through your package manager formula, not the wheel.",[22,63,64,65,69,70,58],{},"Keep hand-written guides for the ",[66,67,68],"em",{},"why","; generation only covers the ",[66,71,72],{},"what",[14,74,76],{"id":75},"prerequisites","Prerequisites",[10,78,79,80,85,86,89],{},"A Click or Typer application with help text worth publishing (see\n",[81,82,84],"a",{"href":83},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read\u002F","writing help text","),\nand somewhere to put the output — a docs directory, a site, or a ",[25,87,88],{},"man\u002F"," folder.",[14,91,93],{"id":92},"generating-the-reference","Generating the reference",[95,96],"inline-diagram",{"name":97},"docs-generation-flow",[10,99,100],{},"Typer ships a generator:",[102,103,108],"pre",{"className":104,"code":105,"language":106,"meta":107,"style":107},"language-bash shiki shiki-themes github-light github-dark","uv run typer mytool.cli utils docs --name mytool --output docs\u002Freference.md\n","bash","",[25,109,110],{"__ignoreMap":107},[111,112,115,119,123,126,129,132,135,139,142,145],"span",{"class":113,"line":114},"line",1,[111,116,118],{"class":117},"sScJk","uv",[111,120,122],{"class":121},"sZZnC"," run",[111,124,125],{"class":121}," typer",[111,127,128],{"class":121}," mytool.cli",[111,130,131],{"class":121}," utils",[111,133,134],{"class":121}," docs",[111,136,138],{"class":137},"sj4cs"," --name",[111,140,141],{"class":121}," mytool",[111,143,144],{"class":137}," --output",[111,146,147],{"class":121}," docs\u002Freference.md\n",[10,149,150],{},"It walks the command tree and emits one markdown section per command with its usage line, options\nand help text. For Click, two tools split the job:",[102,152,154],{"className":104,"code":153,"language":106,"meta":107,"style":107},"click-man --target man\u002F mytool             # roff man pages\n",[25,155,156],{"__ignoreMap":107},[111,157,158,160,163,166,168],{"class":113,"line":114},[111,159,31],{"class":117},[111,161,162],{"class":137}," --target",[111,164,165],{"class":121}," man\u002F",[111,167,141],{"class":121},[111,169,171],{"class":170},"sJ8bj","             # roff man pages\n",[102,173,177],{"className":174,"code":175,"language":176,"meta":107,"style":107},"language-python shiki shiki-themes github-light github-dark","# docs\u002Fconf.py — Sphinx\nextensions = [\"sphinx_click\"]\n","python",[25,178,179,184],{"__ignoreMap":107},[111,180,181],{"class":113,"line":114},[111,182,183],{"class":170},"# docs\u002Fconf.py — Sphinx\n",[111,185,187,191,195,198,201],{"class":113,"line":186},2,[111,188,190],{"class":189},"sVt8B","extensions ",[111,192,194],{"class":193},"szBVR","=",[111,196,197],{"class":189}," [",[111,199,200],{"class":121},"\"sphinx_click\"",[111,202,203],{"class":189},"]\n",[102,205,209],{"className":206,"code":207,"language":208,"meta":107,"style":107},"language-rst shiki shiki-themes github-light github-dark",".. click:: mytool.cli:cli\n   :prog: mytool\n   :nested: full\n","rst",[25,210,211,216,221],{"__ignoreMap":107},[111,212,213],{"class":113,"line":114},[111,214,215],{},".. click:: mytool.cli:cli\n",[111,217,218],{"class":113,"line":186},[111,219,220],{},"   :prog: mytool\n",[111,222,224],{"class":113,"line":223},3,[111,225,226],{},"   :nested: full\n",[10,228,229],{},"All three read the same objects your CLI is built from, which is the point: a renamed flag changes\nthe documentation in the same commit, with no human step in between.",[14,231,233],{"id":232},"stopping-drift-with-a-ci-check","Stopping drift with a CI check",[10,235,236],{},"Generating is only half the value. If the output is generated locally and committed by hand, it\nfalls behind the first time somebody forgets.",[95,238],{"name":239},"docs-ci-check",[102,241,245],{"className":242,"code":243,"language":244,"meta":107,"style":107},"language-yaml shiki shiki-themes github-light github-dark","- name: docs are up to date\n  run: |\n    uv run typer mytool.cli utils docs --name mytool --output docs\u002Freference.md\n    git diff --exit-code docs\u002Freference.md\n","yaml",[25,246,247,262,272,277],{"__ignoreMap":107},[111,248,249,252,256,259],{"class":113,"line":114},[111,250,251],{"class":189},"- ",[111,253,255],{"class":254},"s9eBZ","name",[111,257,258],{"class":189},": ",[111,260,261],{"class":121},"docs are up to date\n",[111,263,264,267,269],{"class":113,"line":186},[111,265,266],{"class":254},"  run",[111,268,258],{"class":189},[111,270,271],{"class":193},"|\n",[111,273,274],{"class":113,"line":223},[111,275,276],{"class":121},"    uv run typer mytool.cli utils docs --name mytool --output docs\u002Freference.md\n",[111,278,280],{"class":113,"line":279},4,[111,281,282],{"class":121},"    git diff --exit-code docs\u002Freference.md\n",[10,284,285],{},"Three lines, and the failure message tells the author exactly what to do: run the generator and\ncommit the result. It is the same pattern as a formatter check, and it works for the same reason —\nthe fix is mechanical, so the check never becomes an argument.",[10,287,288],{},"Commit the generated file rather than building it only on the docs site. It makes the change\nvisible in review, which is where somebody notices that a renamed flag is a breaking change.",[14,290,292],{"id":291},"what-a-man-page-needs-that-a-generator-cannot-know","What a man page needs that a generator cannot know",[95,294],{"name":295},"man-page-sections",[10,297,298],{},"Generated man pages are usually thin in the same three places, and they are exactly the sections a\nman page reader looks for.",[10,300,301,304],{},[41,302,303],{},"EXIT STATUS."," Anyone reading a man page is likely writing a script. Document every code:",[102,306,310],{"className":307,"code":308,"language":309,"meta":107,"style":107},"language-roff shiki shiki-themes github-light github-dark",".SH EXIT STATUS\n.TP\n.B 0\nSuccess.\n.TP\n.B 2\nThe command line was invalid.\n.TP\n.B 78\nThe configuration was invalid.\n","roff",[25,311,312,317,322,327,332,337,343,349,354,360],{"__ignoreMap":107},[111,313,314],{"class":113,"line":114},[111,315,316],{},".SH EXIT STATUS\n",[111,318,319],{"class":113,"line":186},[111,320,321],{},".TP\n",[111,323,324],{"class":113,"line":223},[111,325,326],{},".B 0\n",[111,328,329],{"class":113,"line":279},[111,330,331],{},"Success.\n",[111,333,335],{"class":113,"line":334},5,[111,336,321],{},[111,338,340],{"class":113,"line":339},6,[111,341,342],{},".B 2\n",[111,344,346],{"class":113,"line":345},7,[111,347,348],{},"The command line was invalid.\n",[111,350,352],{"class":113,"line":351},8,[111,353,321],{},[111,355,357],{"class":113,"line":356},9,[111,358,359],{},".B 78\n",[111,361,363],{"class":113,"line":362},10,[111,364,365],{},"The configuration was invalid.\n",[10,367,368,371,372,51,375,378],{},[41,369,370],{},"ENVIRONMENT."," Every variable your tool reads, including the ones you honour by convention\n(",[25,373,374],{},"NO_COLOR",[25,376,377],{},"MYTOOL_CONFIG","). A variable that changes behaviour and is undocumented is\nindistinguishable from a bug.",[10,380,381,384],{},[41,382,383],{},"FILES."," The configuration paths you search, in order. This is the section that answers \"why is\nit not using my settings\" without a support conversation.",[10,386,387,388,390],{},"The practical approach is to keep these three as a small hand-written ",[25,389,309],{}," fragment and\nconcatenate it onto the generated page during the build, so the generated parts stay generated and\nthe human parts stay human.",[102,392,394],{"className":104,"code":393,"language":106,"meta":107,"style":107},"click-man --target man\u002F mytool\ncat man\u002Fmytool.1 man\u002F_sections.1.in > man\u002Fmytool.1.tmp && mv man\u002Fmytool.1.tmp man\u002Fmytool.1\ngzip -kf man\u002Fmytool.1\n",[25,395,396,407,435],{"__ignoreMap":107},[111,397,398,400,402,404],{"class":113,"line":114},[111,399,31],{"class":117},[111,401,162],{"class":137},[111,403,165],{"class":121},[111,405,406],{"class":121}," mytool\n",[111,408,409,412,415,418,421,424,427,430,432],{"class":113,"line":186},[111,410,411],{"class":117},"cat",[111,413,414],{"class":121}," man\u002Fmytool.1",[111,416,417],{"class":121}," man\u002F_sections.1.in",[111,419,420],{"class":193}," >",[111,422,423],{"class":121}," man\u002Fmytool.1.tmp",[111,425,426],{"class":189}," && ",[111,428,429],{"class":117},"mv",[111,431,423],{"class":121},[111,433,434],{"class":121}," man\u002Fmytool.1\n",[111,436,437,440,443],{"class":113,"line":223},[111,438,439],{"class":117},"gzip",[111,441,442],{"class":137}," -kf",[111,444,434],{"class":121},[14,446,448],{"id":447},"shipping-the-man-page","Shipping the man page",[10,450,451,452,455],{},"A wheel is not a good vehicle for a man page: there is no standard location inside a Python\npackage that ",[25,453,454],{},"man"," will search, and installing into system paths from a wheel is unwelcome.",[10,457,458],{},"The routes that work:",[19,460,461,470,479],{},[22,462,463,258,466,469],{},[41,464,465],{},"Homebrew formula",[25,467,468],{},"man1.install \"man\u002Fmytool.1\""," in the install block.",[22,471,472,475,476,58],{},[41,473,474],{},"Distribution package",": the packaging metadata places it in ",[25,477,478],{},"\u002Fusr\u002Fshare\u002Fman\u002Fman1\u002F",[22,480,481,488,489,58],{},[41,482,483,484,487],{},"A ",[25,485,486],{},"mytool docs man"," subcommand"," that prints the roff to stdout, so a user can install it\nthemselves: ",[25,490,491],{},"mytool docs man | sudo tee \u002Fusr\u002Flocal\u002Fshare\u002Fman\u002Fman1\u002Fmytool.1 >\u002Fdev\u002Fnull",[10,493,494],{},"The last is a nice fallback for pipx installs, where nothing else will place the file for you.",[14,496,498],{"id":497},"ux-considerations","UX considerations",[10,500,501,504,505,508],{},[41,502,503],{},"Do not generate a page per command as separate files"," unless your tool is very large. One\nreference page with anchors is easier to search, and ",[25,506,507],{},"Ctrl-F"," beats navigating a tree of twenty\nstub pages.",[10,510,511,514],{},[41,512,513],{},"Link from the epilog to the docs, not the other way round."," A user in a terminal needs a URL;\na user on the docs site already has navigation.",[10,516,517,520,521,32,524,527],{},[41,518,519],{},"Keep hand-written guides separate from generated reference."," Mixing them means the generator\neither overwrites your prose or has to be taught to merge, and both end badly. Two directories —\n",[25,522,523],{},"docs\u002Fguides\u002F",[25,525,526],{},"docs\u002Freference.md"," — keep the boundary obvious.",[10,529,530,533],{},[41,531,532],{},"Version the docs with the tool."," If you publish a site, the reference for 1.4 should stay\navailable when 2.0 ships, because people run old versions for years.",[14,535,537],{"id":536},"testing-the-behaviour","Testing the behaviour",[10,539,540],{},"Beyond the CI diff check, two assertions are worth having in the test suite:",[102,542,544],{"className":174,"code":543,"language":176,"meta":107,"style":107},"def test_every_command_appears_in_the_reference():\n    reference = Path(\"docs\u002Freference.md\").read_text()\n    for command in app.registered_commands:\n        assert f\"## {command.name}\" in reference, f\"{command.name} missing from the reference\"\n\ndef test_documented_exit_codes_match_the_code():\n    documented = set(re.findall(r\"^\\.B (\\d+)$\", Path(\"man\u002F_sections.1.in\").read_text(), re.M))\n    assert {str(code) for code in EXIT_CODES.values()} \u003C= {int(c) for c in documented} | set()\n",[25,545,546,557,573,587,630,636,645,694],{"__ignoreMap":107},[111,547,548,551,554],{"class":113,"line":114},[111,549,550],{"class":193},"def",[111,552,553],{"class":117}," test_every_command_appears_in_the_reference",[111,555,556],{"class":189},"():\n",[111,558,559,562,564,567,570],{"class":113,"line":186},[111,560,561],{"class":189},"    reference ",[111,563,194],{"class":193},[111,565,566],{"class":189}," Path(",[111,568,569],{"class":121},"\"docs\u002Freference.md\"",[111,571,572],{"class":189},").read_text()\n",[111,574,575,578,581,584],{"class":113,"line":223},[111,576,577],{"class":193},"    for",[111,579,580],{"class":189}," command ",[111,582,583],{"class":193},"in",[111,585,586],{"class":189}," app.registered_commands:\n",[111,588,589,592,595,598,601,604,607,610,613,616,619,621,623,625,627],{"class":113,"line":279},[111,590,591],{"class":193},"        assert",[111,593,594],{"class":193}," f",[111,596,597],{"class":121},"\"## ",[111,599,600],{"class":137},"{",[111,602,603],{"class":189},"command.name",[111,605,606],{"class":137},"}",[111,608,609],{"class":121},"\"",[111,611,612],{"class":193}," in",[111,614,615],{"class":189}," reference, ",[111,617,618],{"class":193},"f",[111,620,609],{"class":121},[111,622,600],{"class":137},[111,624,603],{"class":189},[111,626,606],{"class":137},[111,628,629],{"class":121}," missing from the reference\"\n",[111,631,632],{"class":113,"line":334},[111,633,635],{"emptyLinePlaceholder":634},true,"\n",[111,637,638,640,643],{"class":113,"line":339},[111,639,550],{"class":193},[111,641,642],{"class":117}," test_documented_exit_codes_match_the_code",[111,644,556],{"class":189},[111,646,647,650,652,655,658,661,663,666,670,674,677,680,683,685,688,691],{"class":113,"line":345},[111,648,649],{"class":189},"    documented ",[111,651,194],{"class":193},[111,653,654],{"class":137}," set",[111,656,657],{"class":189},"(re.findall(",[111,659,660],{"class":193},"r",[111,662,609],{"class":121},[111,664,665],{"class":137},"^",[111,667,669],{"class":668},"snhLl","\\.",[111,671,673],{"class":672},"sA_wV","B ",[111,675,676],{"class":137},"(\\d",[111,678,679],{"class":193},"+",[111,681,682],{"class":137},")$",[111,684,609],{"class":121},[111,686,687],{"class":189},", Path(",[111,689,690],{"class":121},"\"man\u002F_sections.1.in\"",[111,692,693],{"class":189},").read_text(), re.M))\n",[111,695,696,699,702,705,708,711,714,716,719,722,725,727,730,733,735,738,740,743,746,748],{"class":113,"line":351},[111,697,698],{"class":193},"    assert",[111,700,701],{"class":189}," {",[111,703,704],{"class":137},"str",[111,706,707],{"class":189},"(code) ",[111,709,710],{"class":193},"for",[111,712,713],{"class":189}," code ",[111,715,583],{"class":193},[111,717,718],{"class":137}," EXIT_CODES",[111,720,721],{"class":189},".values()} ",[111,723,724],{"class":193},"\u003C=",[111,726,701],{"class":189},[111,728,729],{"class":137},"int",[111,731,732],{"class":189},"(c) ",[111,734,710],{"class":193},[111,736,737],{"class":189}," c ",[111,739,583],{"class":193},[111,741,742],{"class":189}," documented} ",[111,744,745],{"class":193},"|",[111,747,654],{"class":137},[111,749,750],{"class":189},"()\n",[10,752,753],{},"The second one is the useful oddity: it compares the codes in your error-boundary mapping with the\ncodes in the man page, so adding a code without documenting it fails the build. Given that exit\ncodes are part of your public interface, that is a check worth having.",[14,755,757],{"id":756},"conclusion","Conclusion",[10,759,760],{},"Generate the reference from the command tree, commit it, and let CI fail when the two disagree.\nWrite by hand only what generation cannot know — exit codes, environment variables, config paths\nand the reasoning behind commands — and keep those in files the generator never touches. The result\nis documentation that cannot quietly become wrong.",[14,762,764],{"id":763},"frequently-asked-questions","Frequently asked questions",[766,767,769],"h3",{"id":768},"should-generated-docs-be-committed-or-built-on-the-fly","Should generated docs be committed or built on the fly?",[10,771,772],{},"Committed. A generated file in the repository makes an interface change visible in review, which is\nwhere it should be noticed, and it means the documentation exists even when the site build is\nbroken. The CI diff check is what keeps the committed copy honest.",[766,774,776],{"id":775},"how-do-i-document-subcommand-trees-several-levels-deep","How do I document subcommand trees several levels deep?",[10,778,779,780,783],{},"One page with nested headings, generated with ",[25,781,782],{},"--nested full"," or the equivalent. Deep trees are\nharder to read as separate pages, and a single page lets a reader search across the whole\ninterface — which is usually what they are trying to do.",[766,785,787],{"id":786},"can-i-generate-documentation-for-argparse","Can I generate documentation for argparse?",[10,789,790,793,794,797],{},[25,791,792],{},"argparse-manpage"," produces man pages, and ",[25,795,796],{},"sphinx-argparse"," covers Sphinx. Both are less polished\nthan the Click and Typer equivalents, which is one of the smaller reasons people move to a\nframework once a tool has documentation obligations.",[766,799,801],{"id":800},"what-about-a-docs-site-is-generated-reference-enough","What about a docs site — is generated reference enough?",[10,803,804],{},"No. Reference tells someone what a flag does; it never tells them which command to reach for or\nwhy. Aim for a short set of hand-written task guides (\"how do I sync a directory\", \"how do I\nrecover from a failed migration\") plus the generated reference underneath them.",[766,806,808],{"id":807},"how-do-i-keep-the-man-page-and-the-help-output-consistent","How do I keep the man page and the help output consistent?",[10,810,811],{},"By generating both from the same source. If you hand-edit the roff, you have created a second copy\nthat will drift. The only sections worth writing by hand are the ones with no equivalent in the\ncommand tree, which is why keeping them in a separate fragment matters.",[766,813,815],{"id":814},"should-the-docs-site-be-versioned","Should the docs site be versioned?",[10,817,818,819,822,823,826],{},"If people run old versions — and for a CLI they always do — yes. A ",[25,820,821],{},"\u002Flatest\u002F"," alias plus a\ndirectory per minor version costs a little build configuration and answers the question \"what did\n",[25,824,825],{},"--mode"," do in 1.4\" without archaeology. If you only ever publish one version, at least state which\none the site describes, prominently.",[766,828,830],{"id":829},"how-do-i-generate-documentation-for-plugin-commands","How do I generate documentation for plugin commands?",[10,832,833],{},"Only for the plugins installed in the environment doing the generation, which is exactly what makes\nthis awkward. The usual arrangement is to generate the host's reference from the host alone, and\nlet each plugin document its own commands — with a page on your site listing known plugins and\nlinking to them.",[766,835,837],{"id":836},"is-a-generated-reference-enough-for-a-docs-site","Is a generated reference enough for a docs site?",[10,839,840],{},"It is the foundation, not the whole thing. Readers arriving from a search engine are looking for a\ntask (\"how do I mirror a directory\") rather than a flag, so a handful of hand-written task pages\nlinking into the generated reference is what turns a wall of options into something navigable. The\nreference answers the follow-up question, which is the right division of labour.",[14,842,844],{"id":843},"related","Related",[19,846,847,854,860,866,873],{},[22,848,849,850],{},"Up: ",[81,851,853],{"href":852},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002F","CLI help output and documentation",[22,855,856,857],{},"Sideways: ",[81,858,859],{"href":83},"Writing help text users actually read",[22,861,856,862],{},[81,863,865],{"href":864},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags\u002F","Versioning and deprecating CLI flags",[22,867,868,869],{},"Related: ",[81,870,872],{"href":871},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis\u002F","Homebrew and Scoop packaging for Python CLIs",[22,874,868,875],{},[81,876,878],{"href":877},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools\u002F","Choosing exit codes for CLI tools",[880,881,882],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .snhLl, html code.shiki .snhLl{--shiki-default:#22863A;--shiki-default-font-weight:bold;--shiki-dark:#85E89D;--shiki-dark-font-weight:bold}html pre.shiki code .sA_wV, html code.shiki .sA_wV{--shiki-default:#032F62;--shiki-dark:#DBEDFF}html pre.shiki code .s9eBZ, html code.shiki .s9eBZ{--shiki-default:#22863A;--shiki-dark:#85E89D}",{"title":107,"searchDepth":186,"depth":186,"links":884},[885,886,887,888,889,890,891,892,893,894,904],{"id":16,"depth":186,"text":17},{"id":75,"depth":186,"text":76},{"id":92,"depth":186,"text":93},{"id":232,"depth":186,"text":233},{"id":291,"depth":186,"text":292},{"id":447,"depth":186,"text":448},{"id":497,"depth":186,"text":498},{"id":536,"depth":186,"text":537},{"id":756,"depth":186,"text":757},{"id":763,"depth":186,"text":764,"children":895},[896,897,898,899,900,901,902,903],{"id":768,"depth":223,"text":769},{"id":775,"depth":223,"text":776},{"id":786,"depth":223,"text":787},{"id":800,"depth":223,"text":801},{"id":807,"depth":223,"text":808},{"id":814,"depth":223,"text":815},{"id":829,"depth":223,"text":830},{"id":836,"depth":223,"text":837},{"id":843,"depth":186,"text":844},"2026-08-01","Generate reference docs and man pages from a Python command tree - Typer and Click generators, packaging man pages, and a CI check that stops drift.","intermediate",false,"md",{},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fgenerating-man-pages-and-docs-from-a-cli",{"title":5,"description":906},"advanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fgenerating-man-pages-and-docs-from-a-cli\u002Findex",[915,916,917,918,919],"documentation","man-pages","typer","click","ci","1ZhYSV-pJ78LpYwgxt54yl-NZ6YaTCDALgbXx4KS8pg",[922,925,928,931,934,937,938,941,944,947,950,953,956,959,962,965,968,971,974,977,980,983,986,989,992,995,998,1001,1004,1007,1010,1013,1016,1019,1022,1025,1028,1031,1034,1037,1040,1043,1046,1049,1052,1055,1058,1061,1064,1067,1070,1073,1076,1079,1082,1085,1088,1091,1094,1097,1100,1103,1106,1109,1112,1115,1118,1121,1124,1127,1130,1133,1136,1139,1142,1145,1148,1151,1154,1157,1160,1163,1166],{"path":923,"title":924},"\u002Fabout","About Python CLI Toolcraft",{"path":926,"title":927},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies","Advanced Argument Validation Strategies",{"path":929,"title":930},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fparsing-nested-json-arguments-in-python-clis","Parsing Nested JSON Args in Python CLIs",{"path":932,"title":933},"\u002Fadvanced-input-parsing-user-experience\u002Fadvanced-argument-validation-strategies\u002Fvalidating-file-and-directory-paths-in-clis","Validating File and Directory Paths in CLIs",{"path":935,"title":936},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fadding-examples-and-epilogs-to-help-output","Adding Examples and Epilogs to Help Output",{"path":911,"title":5},{"path":939,"title":940},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation","CLI Help Output and Documentation",{"path":942,"title":943},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fversioning-and-deprecating-cli-flags","Versioning and Deprecating CLI Flags",{"path":945,"title":946},"\u002Fadvanced-input-parsing-user-experience\u002Fcli-help-output-and-documentation\u002Fwriting-help-text-users-actually-read","Writing Help Text Users Actually Read",{"path":948,"title":949},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fchoosing-exit-codes-for-cli-tools","Choosing Exit Codes for CLI Tools",{"path":951,"title":952},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Ffriendly-error-messages-and-tracebacks","Friendly Error Messages and Tracebacks",{"path":954,"title":955},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes\u002Fhandling-keyboard-interrupt-cleanly","Handling Keyboard Interrupt Cleanly",{"path":957,"title":958},"\u002Fadvanced-input-parsing-user-experience\u002Ferror-handling-and-exit-codes","Error Handling and Exit Codes for CLIs",{"path":960,"title":961},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Fconfig-precedence-flags-env-files-defaults","Config Precedence: Flags, Env, Files, Defaults",{"path":963,"title":964},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars","Handling Config Files and Env Vars in CLIs",{"path":966,"title":967},"\u002Fadvanced-input-parsing-user-experience\u002Fhandling-configuration-files-env-vars\u002Floading-yaml-configs-safely-in-cli-apps","Loading YAML configs safely in CLI apps",{"path":969,"title":970},"\u002Fadvanced-input-parsing-user-experience","Advanced Input Parsing for Python CLIs",{"path":972,"title":973},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Fadding-progress-bars-and-spinners-to-python-clis","Progress Bars and Spinners for Python CLIs",{"path":975,"title":976},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich","Interactive Terminal UI with Rich",{"path":978,"title":979},"\u002Fadvanced-input-parsing-user-experience\u002Finteractive-terminal-ui-with-rich\u002Frendering-tables-and-json-with-rich","Rendering Tables and JSON with Rich",{"path":981,"title":982},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Fenabling-tab-completion-in-click-and-typer","Enabling Tab Completion in Click and Typer",{"path":984,"title":985},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis","Shell Completion for Python CLIs",{"path":987,"title":988},"\u002Fadvanced-input-parsing-user-experience\u002Fshell-completion-for-python-clis\u002Finstalling-shell-completion-for-bash-zsh-fish","Installing Shell Completion for bash, zsh, fish",{"path":990,"title":991},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fadding-verbose-and-quiet-logging-flags","Adding Verbose and Quiet Logging Flags",{"path":993,"title":994},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps","Structured Logging for CLI Apps",{"path":996,"title":997},"\u002Fadvanced-input-parsing-user-experience\u002Fstructured-logging-for-cli-apps\u002Fstructured-json-logging-in-python-clis","Structured JSON Logging in Python CLIs",{"path":999,"title":1000},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fdetecting-tty-and-adapting-output","Detecting a TTY and Adapting Output",{"path":1002,"title":1003},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Femitting-json-output-for-scripting","Emitting JSON Output for Scripting",{"path":1005,"title":1006},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Fhandling-broken-pipe-and-sigpipe","Handling Broken Pipe and SIGPIPE",{"path":1008,"title":1009},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes","Working with stdin, stdout and Pipes",{"path":1011,"title":1012},"\u002Fadvanced-input-parsing-user-experience\u002Fworking-with-stdin-stdout-and-pipes\u002Freading-piped-input-in-python-clis","Reading Piped Input in Python CLIs",{"path":1014,"title":1015},"\u002F","Python CLI Toolcraft",{"path":1017,"title":1018},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading","CLI Startup Performance and Lazy Loading",{"path":1020,"title":1021},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Flazy-loading-subcommands-for-faster-startup","Lazy Loading Subcommands for Faster Startup",{"path":1023,"title":1024},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Fprofiling-python-cli-startup-time","Profiling Python CLI Startup Time",{"path":1026,"title":1027},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcli-startup-performance-and-lazy-loading\u002Freducing-cli-dependency-weight","Reducing CLI Dependency Weight",{"path":1029,"title":1030},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-subparsers-for-subcommands","argparse Subparsers for Subcommands",{"path":1032,"title":1033},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fargparse-vs-click-vs-typer-comparison","argparse vs Click vs Typer Compared",{"path":1035,"title":1036},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse","Command-Line Parsing with argparse",{"path":1038,"title":1039},"\u002Fmodern-python-cli-frameworks-architecture\u002Fcommand-line-parsing-with-argparse\u002Fmigrating-from-argparse-to-typer","Migrating from argparse to Typer",{"path":1041,"title":1042},"\u002Fmodern-python-cli-frameworks-architecture","Python CLI Frameworks and Architecture",{"path":1044,"title":1045},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis","Plugin Architectures for Extensible CLIs",{"path":1047,"title":1048},"\u002Fmodern-python-cli-frameworks-architecture\u002Fplugin-architectures-for-extensible-clis\u002Fwriting-a-plugin-for-an-existing-cli","Writing a Plugin for an Existing CLI",{"path":1050,"title":1051},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fbest-practices-for-python-cli-entry-points","Best practices for Python CLI entry points",{"path":1053,"title":1054},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fdependency-injection-patterns-for-cli-commands","Dependency Injection Patterns for CLI Commands",{"path":1056,"title":1057},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fhow-to-structure-a-large-python-cli-project","Structuring a Large Python CLI Project",{"path":1059,"title":1060},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis","Structuring Multi-Command Python CLIs",{"path":1062,"title":1063},"\u002Fmodern-python-cli-frameworks-architecture\u002Fstructuring-multi-command-python-clis\u002Fsharing-state-with-click-context-objects","Sharing State with Click Context Objects",{"path":1065,"title":1066},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications","Testing Python CLI Applications",{"path":1068,"title":1069},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmeasuring-cli-test-coverage","Measuring CLI Test Coverage",{"path":1071,"title":1072},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fmocking-filesystem-and-network-in-cli-tests","Mocking the Filesystem and Network in CLI Tests",{"path":1074,"title":1075},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Fsnapshot-testing-cli-output","Snapshot Testing CLI Output",{"path":1077,"title":1078},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-click-commands-with-clirunner","Testing Click Commands with CliRunner",{"path":1080,"title":1081},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftesting-python-cli-applications\u002Ftesting-interactive-prompts-and-stdin","Testing Interactive Prompts and stdin",{"path":1083,"title":1084},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fbuilding-a-cli-with-subcommands-in-click","Building a CLI with subcommands in Click",{"path":1086,"title":1087},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Fconverting-a-click-app-to-typer","Converting a Click App to Typer",{"path":1089,"title":1090},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each","Typer vs Click: When to Use Each",{"path":1092,"title":1093},"\u002Fmodern-python-cli-frameworks-architecture\u002Ftyper-vs-click-when-to-use-each\u002Ftyper-callback-functions-explained","Typer callback functions explained",{"path":1095,"title":1096},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter\u002Fcopier-vs-cookiecutter-for-cli-templates","Copier vs Cookiecutter for CLI Templates",{"path":1098,"title":1099},"\u002Fproject-setup-dependency-management\u002Fcli-project-scaffolding-with-cookiecutter","CLI Project Scaffolding with Cookiecutter",{"path":1101,"title":1102},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbuilding-cross-platform-release-binaries-in-ci","Building Cross-Platform Release Binaries in CI",{"path":1104,"title":1105},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fbundling-a-python-cli-with-pyinstaller","Bundling a Python CLI with PyInstaller",{"path":1107,"title":1108},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fhomebrew-and-scoop-packaging-for-python-clis","Homebrew and Scoop Packaging for Python CLIs",{"path":1110,"title":1111},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries","Distributing CLIs as Standalone Binaries",{"path":1113,"title":1114},"\u002Fproject-setup-dependency-management\u002Fdistributing-clis-as-standalone-binaries\u002Fshipping-a-cli-as-a-zipapp-with-shiv","Shipping a CLI as a Zipapp with shiv",{"path":1116,"title":1117},"\u002Fproject-setup-dependency-management","Project Setup & Dependency Management",{"path":1119,"title":1120},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fautomating-changelogs-with-conventional-commits","Automating Changelogs with Conventional Commits",{"path":1122,"title":1123},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs\u002Fexposing-version-info-and-build-metadata","Exposing Version Info and Build Metadata",{"path":1125,"title":1126},"\u002Fproject-setup-dependency-management\u002Fmanaging-cli-versioning-changelogs","Managing CLI Versioning & Changelogs",{"path":1128,"title":1129},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fbuilding-wheels-and-sdists-for-python-clis","Building Wheels and sdists for Python CLIs",{"path":1131,"title":1132},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution","Packaging Python CLIs for Distribution",{"path":1134,"title":1135},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Finstalling-and-distributing-clis-with-pipx","Installing and Distributing CLIs with pipx",{"path":1137,"title":1138},"\u002Fproject-setup-dependency-management\u002Fpackaging-python-clis-for-distribution\u002Fpublishing-a-python-cli-to-pypi","Publishing a Python CLI to PyPI",{"path":1140,"title":1141},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development","Poetry Workflows for CLI Development",{"path":1143,"title":1144},"\u002Fproject-setup-dependency-management\u002Fpoetry-workflows-for-cli-development\u002Fpoetry-entry-points-and-scripts-for-clis","Poetry Entry Points and Scripts for CLIs",{"path":1146,"title":1147},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects","Pre-commit Hooks for CLI Projects",{"path":1149,"title":1150},"\u002Fproject-setup-dependency-management\u002Fpre-commit-hooks-for-cli-projects\u002Fsetting-up-pre-commit-for-python-cli-repos","Setting up pre-commit for Python CLI repos",{"path":1152,"title":1153},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management","uv for Python CLI Dependency Management",{"path":1155,"title":1156},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-init-vs-poetry-init-for-cli-tools","uv init vs poetry init for CLI tools",{"path":1158,"title":1159},"\u002Fproject-setup-dependency-management\u002Fuv-for-python-cli-dependency-management\u002Fuv-tool-install-vs-pipx-for-clis","uv tool install vs pipx for CLIs",{"path":1161,"title":1162},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices","Python CLI Env Isolation Best Practices",{"path":1164,"title":1165},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fmanaging-virtual-environments-for-cross-platform-clis","Managing Python CLI Virtual Environments",{"path":1167,"title":1168},"\u002Fproject-setup-dependency-management\u002Fvirtual-environments-isolation-best-practices\u002Fpinning-the-python-version-for-a-cli","Pinning the Python Version for a CLI",1785614690027]