{"id":10020530,"date":"2024-12-21T11:52:28","date_gmt":"2024-12-21T03:52:28","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020530"},"modified":"2024-12-21T11:52:28","modified_gmt":"2024-12-21T03:52:28","slug":"fastapi-%e7%9a%84-typer-%e4%bc%9a%e6%98%af-click-%e9%a1%b9%e7%9b%ae%e7%9a%84%e4%bc%98%e7%a7%80%e6%9b%bf%e4%bb%a3%e5%93%81%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020530","title":{"rendered":"fastapi \u7684 typer \u4f1a\u662f click \u9879\u76ee\u7684\u4f18\u79c0\u66ff\u4ee3\u54c1\u5417\uff1f"},"content":{"rendered":"<p>\u6700\u8fd1\u5728\u4f7f\u7528 click \u7684\u65f6\u5019\uff0c\u53d1\u73b0\u4e00\u4e2a\u95ee\u9898\uff0c\u5c31\u662f click \u4e0d\u66f4\u65b0\u4e86\uff0c\u6700\u8fd1\u4e00\u6b21\u66f4\u65b0\u5728 2023 \u5e74\u7684 8\u6708\u4efd<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"413\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdfLZf\" alt=\"\u56fe\u7247.png\" title=\"\u56fe\u7247.png\"><\/p>\n<p>\u8fd9\u975e\u5e38\u7684\u7cdf\u7cd5\uff0c\u800c\u4e14 click \u793e\u533a\u8fd8\u6b20\u7740\u6211\u7684\u95ee\u9898\u6ca1\u6709\u7b54\u590d\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=5kmgjQEE1SgkOnNZ2RQzag%3D%3D.NC1giY14h4L1XKLiajVn%2Bogrsgj47nv9y6B7dF5Bk2HvJ%2BVKa3t3WQbVYIw%2FSJta7Pzj8%2BSypnJxabsSyy43XQ%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">How do I add the &#8211;version parameter when using click.CommandCollection<\/a><\/p>\n<p>\u6240\u4ee5\uff0c\u5982\u679c\u4f60\u8981\u7ee7\u7eed\uff08\u76f4\u63a5\uff09\u4f7f\u7528 click \u53ef\u80fd\u5c31\u5f97\u4e0d\u5230\u793e\u533a\u652f\u6301\u4e86<\/p>\n<p>\u662f\u65f6\u5019\u627e\u4e00\u4e2a\u66ff\u4ee3\u54c1\u4e86\uff0c\u6211\u95ee\u4e86\u4e00\u4e0b gemini2.0 \u5b83\u50cf\u6211\u63a8\u8350\u4e86\u4e00\u5806<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5e93<\/th>\n<th>\u7279\u70b9<\/th>\n<th>\u4f18\u70b9<\/th>\n<th>\u7f3a\u70b9<\/th>\n<th>\u9002\u7528\u573a\u666f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>argparse<\/td>\n<td>Python \u5185\u7f6e\uff0c\u529f\u80fd\u9f50\u5168<\/td>\n<td>\u65e0\u9700\u989d\u5916\u4f9d\u8d56\uff0c\u8d44\u6e90\u4e30\u5bcc<\/td>\n<td>\u8bed\u6cd5\u7a0d\u663e\u5197\u957f<\/td>\n<td>\u7b80\u5355\u811a\u672c\u6216\u5de5\u5177<\/td>\n<\/tr>\n<tr>\n<td>plac<\/td>\n<td>\u7b80\u6d01\u7684\u8bed\u6cd5\uff0c\u4f7f\u7528\u88c5\u9970\u5668<\/td>\n<td>\u6613\u4e8e\u4e0a\u624b<\/td>\n<td>\u529f\u80fd\u8f83\u5c11\uff0c\u793e\u533a\u6d3b\u8dc3\u5ea6\u8f83\u4f4e<\/td>\n<td>\u5feb\u901f\u539f\u578b\u5f00\u53d1\u6216\u5c0f\u578b\u5de5\u5177<\/td>\n<\/tr>\n<tr>\n<td>Fire<\/td>\n<td>\u5c06 Python \u5bf9\u8c61\u8f6c\u6362\u4e3a CLI<\/td>\n<td>\u975e\u5e38\u5bb9\u6613\u4f7f\u7528<\/td>\n<td>\u5bf9\u4e8e\u7cbe\u7ec6\u63a7\u5236 CLI \u884c\u4e3a\u7684\u573a\u666f\uff0c\u53ef\u80fd\u4e0d\u591f\u7075\u6d3b<\/td>\n<td>\u5feb\u901f\u5c06\u73b0\u6709\u4ee3\u7801\u8f6c\u6362\u4e3a CLI \u5de5\u5177\u6216\u7ba1\u7406\u811a\u672c<\/td>\n<\/tr>\n<tr>\n<td>Cliff<\/td>\n<td>\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u652f\u6301\u5b50\u547d\u4ee4\u3001\u63d2\u4ef6\u7b49\u9ad8\u7ea7\u7279\u6027<\/td>\n<td>\u529f\u80fd\u5f3a\u5927<\/td>\n<td>\u5b66\u4e60\u66f2\u7ebf\u8f83\u9661\u5ced\uff0c\u5bf9\u4e8e\u7b80\u5355 CLI \u53ef\u80fd\u8fc7\u4e8e\u590d\u6742<\/td>\n<td>\u6784\u5efa\u590d\u6742\u7684\u3001\u591a\u547d\u4ee4\u7684 CLI \u5e94\u7528\u7a0b\u5e8f<\/td>\n<\/tr>\n<tr>\n<td>Typer<\/td>\n<td>\u57fa\u4e8e\u7c7b\u578b\u63d0\u793a\uff0c\u73b0\u4ee3\u5316<\/td>\n<td>\u4ee3\u7801\u63d0\u793a\u548c\u9759\u6001\u5206\u6790\u66f4\u597d\uff0c\u8bed\u6cd5\u7b80\u6d01\uff0c\u6613\u4e8e\u4f7f\u7528<\/td>\n<td>\u76f8\u5bf9\u8f83\u65b0\uff0c\u751f\u6001\u7cfb\u7edf\u4e0d\u5982 click \u6210\u719f<\/td>\n<td>\u8ffd\u6c42\u73b0\u4ee3\u5316\u7684\u5f00\u53d1\u4f53\u9a8c\uff0c\u6ce8\u91cd\u4ee3\u7801\u7c7b\u578b\u5b89\u5168<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6211\u770b\u4e86\u4e00\u904d\u4e0a\u9762\u7684\u5305\uff0c\u89c9\u5f97 <a href=\"https:\/\/link.segmentfault.com\/?enc=IkInqw8bGiGjcaNGEmXTow%3D%3D.vH9jX8UdP6ChkpTPvhSnjZW6OZBpeGvZosj2fAfXj%2B7LdBpLFHzqT%2FthuhwIb%2BiD\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Typer<\/a> \u662f\u6700\u6709\u524d\u9014\u7684\uff0c\u4e3a\u4ec0\u4e48\uff1f\u56e0\u4e3a Typer \u662f fastapi \u793e\u533a\u7684\u7ef4\u62a4\uff0c\u5927\u5bb6\u5e94\u8be5\u61c2\u8fd9\u4e2a\u542b\u91d1\u91cf\u5427\uff1f<\/p>\n<blockquote><p>github \u5730\u5740: <a href=\"https:\/\/link.segmentfault.com\/?enc=hPvxboFGSQWMOJ38x2%2Bgrg%3D%3D.Yt6aHDC6T8lXwhMqFoSnb5ZFbf1V42viSEBt6T15S1ojeZDyM%2FFQho03ygR0HKSY\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/github.com\/fastapi\/typer<\/a><\/p><\/blockquote>\n<p>\u56e0\u4e3a click \u6ca1\u529e\u6cd5\u6ee1\u8db3\u6211\u7684\u9700\u6c42\u4e86\uff0c\u6240\u4ee5\u6211\u6253\u7b97\u540e\u9762\u4f7f\u7528 Typer \u66ff\u4ee3 click \u6765\u91cd\u5199\u6211\u7684 <a href=\"https:\/\/link.segmentfault.com\/?enc=mFY6%2F7wHD8ojhKIjq44K%2Bw%3D%3D.7R3i9H9hQYzwSVtQvZteGiT0rl9I%2Bw195m5dl3eeYJGbC1NPywyt5tnzs1vs4OCK\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">idocker<\/a> \u5de5\u5177<\/p>\n<p>\u9047\u5230\u7684\u5751\u548c\u95ee\u9898\uff0c\u6211\u4f1a\u66f4\u65b0\u5230\u8fd9\u91cc\uff0c\u671f\u5f85\u5427<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000045666044\">https:\/\/segmentfault.com\/a\/1190000045666044<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u4f7f\u7528 click \u7684\u65f6\u5019\uff0c\u53d1\u73b0\u4e00\u4e2a\u95ee\u9898\uff0c\u5c31\u662f click \u4e0d\u66f4\u65b0\u4e86\uff0c\u6700\u8fd1\u4e00\u6b21\u66f4\u65b0\u5728 2023 \u5e74\u7684 8\u6708 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020530","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020530"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020530\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}