diff --git a/CHANGELOG.md b/CHANGELOG.md index 87456b4..1dc145f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ - Sistana (及其上游库)仅支持 Python 3.9 及以上版本。 - Sistana 对各种特性的兼容性尚未完全测试。 +## 1.8.35 + +### 改进 + +- 补全时参数的自定义提示与参数名的组合方式现在可以通过 `lang.set("completion", "prompt_arg", xxx)` 来设置 + ## 1.8.34 ### 改进 diff --git a/exam1.py b/exam1.py index aaa35f4..49deaa2 100644 --- a/exam1.py +++ b/exam1.py @@ -2,14 +2,15 @@ from arclet.alconna import Alconna, Arg, Args, Metadata, CompSession, Option, OptionResult -lang.set("completion", "node", "") -lang.set("completion", "prompt_select", "") +lang.set("alconna", "completion.node", "") +lang.set("alconna", "completion.prompt_arg", "{name} - {prompt}") +lang.set("alconna", "completion.prompt_select", "") api_list = ["saucenao", "ascii2d", "ehentai", "iqdb", "tracemoe"] alc = Alconna( "setu", - Args.content(str), + Args.content(str, completion=lambda: "Image url or file path"), Option("use", Args.api(api_list), help_text="选择搜图使用的 API"), Option("count", Arg("num", int), help_text="设置每次搜图展示的最多数量"), Option("--similarity|-s", Args.val(float), help_text="设置相似度过滤的值", default=OptionResult(args={"val": 0.5})), @@ -28,7 +29,7 @@ print("---------------------------------------------------") print(interface) print("---------------------------------------------------") - print(".enter to confirm, .tab to switch, ctrl+c to cancel") + print(".enter to confirm, .tab to switch, .exit/.q to cancel") print("---------------------------------------------------") while True: cmd = input(">>> ") diff --git a/pdm.lock b/pdm.lock index 9e0b019..bf39a4a 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev", "full"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:18c299199219f7cca4ffab22d3be60da7511830e1d8bb26c3d236849db3ef7f0" +content_hash = "sha256:2c984eae33e615ffac71c97e003a22b68ef6442f34d91f70f3e3c9dbe5208beb" [[metadata.targets]] requires_python = ">=3.9" @@ -310,7 +310,7 @@ files = [ [[package]] name = "nepattern" -version = "1.0.0" +version = "1.0.1" requires_python = ">=3.9" summary = "a complex pattern, support typing" groups = ["default", "full"] @@ -319,8 +319,8 @@ dependencies = [ "typing-extensions>=4.5.0", ] files = [ - {file = "nepattern-1.0.0-py3-none-any.whl", hash = "sha256:bb070f4b4f606c46119a6a2698fba3bfc4054f80006ba3321a502632a04c13bc"}, - {file = "nepattern-1.0.0.tar.gz", hash = "sha256:221772130e6925b12ec8434e25e9405c7f0e2479fb3c5a131e68c4c5dac0b30e"}, + {file = "nepattern-1.0.1-py3-none-any.whl", hash = "sha256:744c8619a63401bd0816dca6c2b835aa46ab179bbd133c6737bbdcf852a2cacb"}, + {file = "nepattern-1.0.1.tar.gz", hash = "sha256:2f735b5f4a250954e3d27d85f75edd61f5bd724f29d21aed10a2e29b55407957"}, ] [[package]] @@ -415,7 +415,7 @@ files = [ [[package]] name = "tarina" -version = "0.6.4" +version = "0.6.8" requires_python = ">=3.9" summary = "A collection of common utils for Arclet" groups = ["default", "full"] @@ -423,83 +423,83 @@ dependencies = [ "typing-extensions>=4.4.0", ] files = [ - {file = "tarina-0.6.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7103d59fbea2374ef2baaa44f28771fa432070801662f81671212e9046564efc"}, - {file = "tarina-0.6.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8b69eadb9cadbe68b158d576ad1c19036cd9631af2ee451983c80bd7922d6432"}, - {file = "tarina-0.6.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5dcf32e68ffc8b45bf9424d5f9677e7e86aa0e93776b9f35d25f6724f8ff1852"}, - {file = "tarina-0.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77963877fbf6459d46b8048449a11c4568dd238b2769b2cc5f66b204d7867fb7"}, - {file = "tarina-0.6.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2234cffddbf8e41dd124d5499d6106e842d5e7b36a957ebd1f2ac29f2d3158d7"}, - {file = "tarina-0.6.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd78306553b61fcc685c2b259e02107297e771122f82f8ceb6f99ddad92c239e"}, - {file = "tarina-0.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3ec086cb37f39942439691c2eb0e184356b7e56c7931b04aca4dbcf0a814dcf"}, - {file = "tarina-0.6.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd57cee3ae8da2149b87ce9c983f0bbe95b808d2e9ef9173a08354570bee0770"}, - {file = "tarina-0.6.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:e30c68a4efa08c942cd764ba4bc4baba065cab90423510e2af58a0b5a4aa5573"}, - {file = "tarina-0.6.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e83ac84458886b8ee1fc5ad2124fb18fd4b96fc357612aa43d9a00d4c61d97a7"}, - {file = "tarina-0.6.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:9acbc120d67b1ac8286b830df979530b9062b2e3c3d18c0c22aecd8643b2bd2b"}, - {file = "tarina-0.6.4-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:8829afe680709ae74a165080aac6cbd59d7a4d2d922c3710113c1e41163569ba"}, - {file = "tarina-0.6.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f47536a38b6af1ae9ebd1d56bd61b81aa01976c7f8d8f3b1ed77d5ae2d60cbc5"}, - {file = "tarina-0.6.4-cp310-cp310-win32.whl", hash = "sha256:a43e93e7650163f8aa8351516c445ed5a591af0ff99d2d477cd5465eab16ca7b"}, - {file = "tarina-0.6.4-cp310-cp310-win_amd64.whl", hash = "sha256:d8f9f26840a68283b4d1e0bf86a528849a87156aedfc2fc6d1fbdf538a4d9a64"}, - {file = "tarina-0.6.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:34979ecf4fa23b4db00988fc8adbf48d4531642c3bdd8ddfab1dfd807c0ba99c"}, - {file = "tarina-0.6.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:be77d77d4eb2f5876eefe949a684f1ad3e15e9748665958c393ef8c680453a07"}, - {file = "tarina-0.6.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d8b4859919692d4a2ded6afdcbe1bf20eca9b2b490378da32dacd67f34ec53d2"}, - {file = "tarina-0.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7f9063814d57eb05504427cfe2639f70609fb9785da9a2cf50a1d48f157c87f4"}, - {file = "tarina-0.6.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8aaccfb073b771853bd25b55a44a27e2b8edbefd1461998e72c6ee5ced59352c"}, - {file = "tarina-0.6.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c339e1f886fabd01d8e5ac7849ce59db335cce9d89e71e823828b133631f3096"}, - {file = "tarina-0.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d40add588014d164a3443fe8dea1646719af1aabe400e0e3f4e223d1a9217714"}, - {file = "tarina-0.6.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:41a2a99b4c14853e1a120ccf4deae39ac57461f013a14a89ecd3a8e49492449c"}, - {file = "tarina-0.6.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7c2b1c9cc7bb7eceb658c9c2866b59b45a807e746f88ec7a92fc658dc1f8d796"}, - {file = "tarina-0.6.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:121ec81d8bacdf1bc9cd2b928f390cb67dbacc1891182100f6ca8fd93546ee53"}, - {file = "tarina-0.6.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:ca81a5ce03348b5e7207bbb83595fd6fe37a8e70eb2355c5a1c774fc14d80f36"}, - {file = "tarina-0.6.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:acd34f3808dcb8e1c5fae21ee23aae5483997b80528e28e635e60e79c3e3a54e"}, - {file = "tarina-0.6.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d3f18231c434463aff3af0a59f78fb845be48e656c370bfbc966c9bc1a90eedc"}, - {file = "tarina-0.6.4-cp311-cp311-win32.whl", hash = "sha256:7307c20afd1c7336cdd0e4612462a97aa0e93172d03036ebb346a99e9627d45a"}, - {file = "tarina-0.6.4-cp311-cp311-win_amd64.whl", hash = "sha256:e6ba7e793d7ca742d31f0a1daef073b0f0b2a61dd69308e3cadaeedff46a495f"}, - {file = "tarina-0.6.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:32bf3a98a830a3890a1fe345ac220e03599d6c9ce3145de11a681d6ee325bd0e"}, - {file = "tarina-0.6.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f5fd44e216c7a37062716c38fdd536e673e74263942af88fa8df0def1f5627ce"}, - {file = "tarina-0.6.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ae5059820bb1f123f7c4439011edf7baf4730b80ed271f7d7a7c7ae0255b8f52"}, - {file = "tarina-0.6.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:477b6575723da912ed8e22ad7658b41590dfe44271e694601ae57f528d950217"}, - {file = "tarina-0.6.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a5f9eb741674d9c2a63c09e1fae0e152c1888174eeb66602e97d80c923a68a05"}, - {file = "tarina-0.6.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a655c855e3fca93b54d9fec28145bc5717e661734a2eab1e9ee442565bc5dcdf"}, - {file = "tarina-0.6.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f29f718468538671b29ae2e39b90219dc74c0cced512eeb297fe5dbf9b7a6761"}, - {file = "tarina-0.6.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:801d0a1943a9682eafd98118c1116f97b3874066f2f5dc4d4b190c653d13a422"}, - {file = "tarina-0.6.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:bcf4822d3ac9aa932dd2de70938baa2916bbcc0ac46e4cdb4516d178505da0bd"}, - {file = "tarina-0.6.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:56b30d3273756a3301c29b26fb3c06a07cd86019a633be2a8da3c5a8c480d893"}, - {file = "tarina-0.6.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:03d3adebd3cfe3d97cb03c73cc3a7c9a730a08137a11a26a814cead595c65614"}, - {file = "tarina-0.6.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:7febfdc6da11d399289046532016c375d759730ac72e8bf67fc8c60b3402d5da"}, - {file = "tarina-0.6.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8a3fb282773aa899fb1a61232f434abe914941ba35b7ae943c17d93433940e65"}, - {file = "tarina-0.6.4-cp312-cp312-win32.whl", hash = "sha256:df976004f1108781d538cca27278abcb6acd219f596de565c3259276cc31eb78"}, - {file = "tarina-0.6.4-cp312-cp312-win_amd64.whl", hash = "sha256:71e352b3e36b3d4554e98650e60faa62143bc8ec610b15ce5bfe82fa259b57a9"}, - {file = "tarina-0.6.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba2326b7c5ecf9d9c064e7e445c51f33b1157f05beaf005b7b360c247b2a5e32"}, - {file = "tarina-0.6.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:6913707eb4b81bf3fc60cac7293f1985c0c62cec97bb988422bfc073f39c9c74"}, - {file = "tarina-0.6.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:264e6fdf19ebda5e61ac307a1291349162e6c20cf3e3700fcea0e5737d801074"}, - {file = "tarina-0.6.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2650e12b58683b399590873b6ce39048418a333cfc986673fbfda3e942da5aee"}, - {file = "tarina-0.6.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cf24713bcc41a427b8891cb3682f1df3854190500fc6c30046166b5ff3c341ad"}, - {file = "tarina-0.6.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f541d714f5ec51c4fad929151fb941b43e98248235d161a8216c874f171a2a29"}, - {file = "tarina-0.6.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f79fda582466fa93d2462f2633ce542422f376441a71f07e0aee6ddb156e249c"}, - {file = "tarina-0.6.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aeb029f6e6be4f715ba9ba67d6f4c5213a31dc82c5ae83833fd034811dec40d1"}, - {file = "tarina-0.6.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0dc2f4ead738fd3d8c202a8b56117b25e9ea2bd7fe458a9bd4e9ec030468ece3"}, - {file = "tarina-0.6.4-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:a5532c4010c598928f9541aff07ad13c4f5bd77e756acef6e2d2fac39c8b195f"}, - {file = "tarina-0.6.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:04a83ec7f85e33f1b6a89e17f1e9d413d8474945fcc9a130fec8a224a2018765"}, - {file = "tarina-0.6.4-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:d9640caebf4cc96307a009f7323342404526fd6d70b92e0b1f4a8fcf695cb3c0"}, - {file = "tarina-0.6.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:398df8fb33e569d29acb04f16e0d14f90ed4b5dc3752e302908122042314420c"}, - {file = "tarina-0.6.4-cp313-cp313-win32.whl", hash = "sha256:3f18496c48cc1ef58353575eaab7ebd182347fc0dddd7ddf2a18bb00246d282a"}, - {file = "tarina-0.6.4-cp313-cp313-win_amd64.whl", hash = "sha256:ff83b121168a08b30c91dd6686fa3e27e7f9833ac6809d00abeb1f96be551229"}, - {file = "tarina-0.6.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:47a12ac3da9c7f116eb042615a77e34b1d9db985797c45402decde3f5602504c"}, - {file = "tarina-0.6.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ae246657043414cc190ab0585712723de8d7a24b57781542da47d8dfbedbec8e"}, - {file = "tarina-0.6.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d0beee6ad97d3b4b2c6c49623d39a163152ec8a466220db0135976090ead9327"}, - {file = "tarina-0.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5ec09acd6976f63606da3f154279e834dd56190cfa7df33c49bc2c6995d0c75"}, - {file = "tarina-0.6.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:888173bb30a4dec321ae1bc902aa91bba6e79656dc8df2c00b5e9ded8cbc79d2"}, - {file = "tarina-0.6.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:291c96f3b14d02fb18a3831963b4a5299e932d6aba33eff324a81c4e3fb0b758"}, - {file = "tarina-0.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ea32160c94ea4687ceb39696459ac3d9edbcce12ee7614dfccdb1dfda587b42a"}, - {file = "tarina-0.6.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:998afedbeb1f55aae176315726a4494b81d8824be61aeb541332afb564264854"}, - {file = "tarina-0.6.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:42eacd4cba265349b358cf95b273f64662a759c269cdecd8a0ba29ba28c871a7"}, - {file = "tarina-0.6.4-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:c63bfbd60f590c5fc244e8f7ac162c6b2287c825cd557e3bb47c8be16491a0d0"}, - {file = "tarina-0.6.4-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:31980539da8ee0ba707c5cfcaf7d396ff8e5c6821337060611b9b45e3281cdbc"}, - {file = "tarina-0.6.4-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:363d4886399b1301aa1cba68619f1664034324cb32cf6ce58e4647f5ce006226"}, - {file = "tarina-0.6.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:945031cc48da4b381904c1fa6f278abe5062636e32b74b2d537480b5fac8ba3e"}, - {file = "tarina-0.6.4-cp39-cp39-win32.whl", hash = "sha256:8b9fdedb406583b82692a64a0b53e331ab29bc66fa563d9497521227992e60f5"}, - {file = "tarina-0.6.4-cp39-cp39-win_amd64.whl", hash = "sha256:85ddc413dd7163adbe825a9ad1328d53749a50c7adab817741d255d244a5707d"}, - {file = "tarina-0.6.4-py3-none-any.whl", hash = "sha256:f808c5eb5f59a2568c715131a99f665a0aff4ad697ed9c13dc7aa39d8086c75b"}, - {file = "tarina-0.6.4.tar.gz", hash = "sha256:a421bec7e5e6b2af9728984cf749d379d2b05a215f55790a9181fb0c452a5520"}, + {file = "tarina-0.6.8-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a2f7b7e61912a020d6ba3c591c4edbc31bb468544640bd814470c69a07dcc4cd"}, + {file = "tarina-0.6.8-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1cac7cbd49317b8e63eba7d0ce0ba11e1218ab51c9d6ee9df8404b5e226db15b"}, + {file = "tarina-0.6.8-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:69d9923d888948ccc9d20a191ab1f6ff2bc097f4154b6a3780c45dc78ae047cd"}, + {file = "tarina-0.6.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b0f12395301584e0d56c7edd6118c5b5732b456067735ee7f0800575d5d490f"}, + {file = "tarina-0.6.8-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:84bd95b18c7f6a55606b0071654137b98f70faf5d12343d361377cf0d81ecde6"}, + {file = "tarina-0.6.8-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94e6ee4df273e1fd3eaf36de7c78a93dde08bf2ad67526122afab1b077e344d9"}, + {file = "tarina-0.6.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7afc1a8a11983f39cce18ad7f8d27601c4d34b1ffe1a1aca2a59b4111d181d01"}, + {file = "tarina-0.6.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e0f74dc96979b774d7e23b964886137f7cf5f58cb2d652c23c3e2d42c1ad39a9"}, + {file = "tarina-0.6.8-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3493d59ef19d1ded232e7a33e52c7d6ebfff66f30ac4c3649ae765b14dacc393"}, + {file = "tarina-0.6.8-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:323351247817dac174f609104c54fcdc4923aaf3ac5e4a4a81c3efaa007d5778"}, + {file = "tarina-0.6.8-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:eb7407046d8051b062f71440b90a11be3ef1a64e99b1c6be157312fe2889e4f4"}, + {file = "tarina-0.6.8-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:50bbbb249d0849855cf43f4fa09c4eecac53e76a54c876ef1a7fb967f17d35b6"}, + {file = "tarina-0.6.8-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8a05063e41f01f64c3c6e87b740c1e2cebffdcae20b9d89014a934bb2707a2b7"}, + {file = "tarina-0.6.8-cp310-cp310-win32.whl", hash = "sha256:162756b5c0872856c11cc97ed1a618a9118fef3fb6999edc917578b56f3eb67f"}, + {file = "tarina-0.6.8-cp310-cp310-win_amd64.whl", hash = "sha256:a58a8a6e36e43de8f3a0561cb264abe300ec6bb4a4215f16c316f1db564de6fb"}, + {file = "tarina-0.6.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:c05d38546712014aafcf123e89d90ad75f08ebd40c5a7e4c76db40d2ae11b387"}, + {file = "tarina-0.6.8-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b036d53d2f8ec46fff9f649b5ec70431cdee3a2b99c8706f67d8d55ea4d4e493"}, + {file = "tarina-0.6.8-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:195d2b4a8a8ec2e946ecd8abab70cf3065fbba67e18e971e0412a74a8417a656"}, + {file = "tarina-0.6.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9bbe85a83904eb29143a43511c04a3fea9a7392c70a6216fcec3ba06cf1b83a"}, + {file = "tarina-0.6.8-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4d6b5893b735d24d2a57f6dbb26de92bb5e09e476077a16408e2054f06263530"}, + {file = "tarina-0.6.8-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a74cc68f4678d37d517a2d661184712f15da608510de6b1bb9103d85d6014409"}, + {file = "tarina-0.6.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6dd0f0d769e503fb81d07bd2d342585347f5149803bd7b4b233deaff1833451f"}, + {file = "tarina-0.6.8-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3b7c91a488aa616e141c337cddce1ba1e0bdac6b98362bc15ce76bd3cd71e17"}, + {file = "tarina-0.6.8-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4f0b91da85a816e34a3eb4670d21c26a3909872b1f5525797bedc32a45efd98d"}, + {file = "tarina-0.6.8-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:bf3a5a8fe912d5984627f64cdd187c8a0801c6f3b2f7f12c68cdb5babf691155"}, + {file = "tarina-0.6.8-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:622e226553453a9a873fca5a2d495d2d28003a23834503147954d651186146c4"}, + {file = "tarina-0.6.8-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:198102e526d096f37bfb868f815cb3bfc864e136aa8b70e90a107a38ffb82c15"}, + {file = "tarina-0.6.8-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:07b252f686410fbf1fe64b3b6705dd40ff218bc1d6a67efac640a0a246f66da3"}, + {file = "tarina-0.6.8-cp311-cp311-win32.whl", hash = "sha256:9e4f56478c58706548e0f08bd277666bac783d918257950be49c4a5d8a35e7b0"}, + {file = "tarina-0.6.8-cp311-cp311-win_amd64.whl", hash = "sha256:d0a92b5368a8a1700f0482d0bc3891dccdfc6dc61f7e66101f68544fca10f096"}, + {file = "tarina-0.6.8-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e8e4bf8ed36c92af7b2a973905f5f4f58dabf7490c5dda695534bf5e3b20d92e"}, + {file = "tarina-0.6.8-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:175754132a107c2830a341d3efcae60f44bfd8e0eab56d92537cc6f849ad44e3"}, + {file = "tarina-0.6.8-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c5f983f0c84959589f884777c7ac0b22786d6d183ae367e53265f09e9ed7dc9f"}, + {file = "tarina-0.6.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c8cc5f1bf3c2099377b5de76b0e192bb4fae3dcfcc245be9ed14315b29c8c75"}, + {file = "tarina-0.6.8-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e7067131af4081d8ca3d4e70c96e8903c9e483e4d5af4910b93051602f7e8b34"}, + {file = "tarina-0.6.8-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a66ea0778dcbd9e9b9b226529ed1822261722956468de026655e09b41feee42b"}, + {file = "tarina-0.6.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd8501b0cd51ad8c0e294b46614ef27ef6773324099b5a24711534db55ded44d"}, + {file = "tarina-0.6.8-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5812e903c79c02029bfe61fd0ff30bf2a5ac58e7c5b1ab3abfb0f0b57260c5b8"}, + {file = "tarina-0.6.8-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:60ea05cb8e07a629096d9abbd11258df2bcea03168bc8ef8f369ca0dddfc504a"}, + {file = "tarina-0.6.8-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b2635d27c34353e9431cb995acece3a0b607cde0934ebf8df35f0e4ae70a0335"}, + {file = "tarina-0.6.8-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:542b5359d23f969f275f9e80960ce7f19a2684e93cd3ab659afaeb7ee06de038"}, + {file = "tarina-0.6.8-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:4ba2018a855f59c28f087ec1ec1d892c6afccdd0da8f4347fbf8e3219145d66c"}, + {file = "tarina-0.6.8-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fdf9c5c44d402041df79e747ff9f82c6794875febb053376acdb724043770975"}, + {file = "tarina-0.6.8-cp312-cp312-win32.whl", hash = "sha256:cf44ca009d79d0ecc8541b9067a3b7d086d1939de3bc1b04c164286b0fcf2112"}, + {file = "tarina-0.6.8-cp312-cp312-win_amd64.whl", hash = "sha256:8cd9ff00e2eb9ed6c42b80504005c9b6de4a9afe9ef36771f63b8f9492e38a90"}, + {file = "tarina-0.6.8-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:af3ff4742b0324d590298812997d028a6d6892bfab5680cd266bed0c1bbf90b0"}, + {file = "tarina-0.6.8-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e7919d53f20e7d780b44e1804f7c9006bcf5832f87cfeb8d5432f1c832953ed4"}, + {file = "tarina-0.6.8-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:878f8d9411ed36cf4408751e209a09c5e2363fc06b6074e966995cdbdc365a9d"}, + {file = "tarina-0.6.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa166fe58b65be6aed113fca54851b236cfd5c23e33f5e61c403f7b71eda17a"}, + {file = "tarina-0.6.8-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:04ea6b8f4568fe5b4f167d002fbe05879bfa04a4121b4ca3d294580cfc86b85d"}, + {file = "tarina-0.6.8-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cbdf37600789f34c1eba6bf05e246f8e9a5b46cf93f9652e92d355e767bbc430"}, + {file = "tarina-0.6.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb748ad914898c293771ccdb32c73b3117a15a3234c9d5eb001f834533cf67ef"}, + {file = "tarina-0.6.8-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:55ca473eb8f3bbd70af71a29d59c6c0951e19ae24f3be86259b884fc097028a0"}, + {file = "tarina-0.6.8-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4b124eee1ce8e25f1c1aba0464c95226ce5ed1b35f079f0fce0f993f38d3393b"}, + {file = "tarina-0.6.8-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:4295448f4dd9f54703adde2683cf6a515f0944687868da4ec500d595e6a9122d"}, + {file = "tarina-0.6.8-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:77392b3e53e9e1069b9131b1eb2037c53b360e4d7f3cfa8ae04277fe4e785eb1"}, + {file = "tarina-0.6.8-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:da9771f40ddcd9da087a4fc2d472b548c0da2bb61ad642b7e186ea7098120be6"}, + {file = "tarina-0.6.8-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fac01686a3f9d4461b8ce6ba3afadb5b24138e27f725ee11efc4b057d98d4e4a"}, + {file = "tarina-0.6.8-cp313-cp313-win32.whl", hash = "sha256:a977e3e38535455b38e018ec345f9982c4d2b40945b330aa5c70c1a24a2f8f5b"}, + {file = "tarina-0.6.8-cp313-cp313-win_amd64.whl", hash = "sha256:62445e9a7c0ab7ac8f9c316836ade382f4b9780492f0a8a35a658f827bcb1d7f"}, + {file = "tarina-0.6.8-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:491b46bfd030f64edc8daac99051e9e1a82d4592aaa9d91c86d18da7f1816a8d"}, + {file = "tarina-0.6.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8dab1c7ff584f427ae671ecd0379b5795f3ddfee867c5c8997fb110c35b72901"}, + {file = "tarina-0.6.8-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9f998c32df568da30f236876118f5c359caf00d4935249c78c2e6e15caa1a72f"}, + {file = "tarina-0.6.8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b427b03be5e9d19882558dafd8cae6decc4406f1511741409f1b75a5ce0bf447"}, + {file = "tarina-0.6.8-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ec0bb5da7bbea3df20750acab45403c5fbd5a0b5c4dd7267e6d0cb3669935db4"}, + {file = "tarina-0.6.8-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7acbc4b547fd623beb174431e2d01b2bc2a5d7451fe3d0e9ae3e0118d862d375"}, + {file = "tarina-0.6.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ed03a67986b00411aa5d3cd02896e5daf0e5af44247fd0ef79484b06780a2462"}, + {file = "tarina-0.6.8-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:637740055c0e7da77793e0f2d56189f4620e9db31578c590234f85240364e80d"}, + {file = "tarina-0.6.8-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:9df3d4441b36b7e6ac290b05dd9a1e6193ff0acc2d970be2b855283b76d0ad40"}, + {file = "tarina-0.6.8-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:ff583c3579e5ea939da67c6a32ebced76b270c884d9f686a003f66f32a0cecdc"}, + {file = "tarina-0.6.8-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:91589c96904f6a07ccf7fec977c403bab52aad63bd3a801a32e11d2ee85e1d46"}, + {file = "tarina-0.6.8-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:4a7448cacff18d536c3cf4453282ee29cf401442cba1a50f02981e5d4c374d7f"}, + {file = "tarina-0.6.8-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:96fe4a3a33fa20cc3bd996ef9e4a909b00c37d89bd24d594a6024ca59a26c6c4"}, + {file = "tarina-0.6.8-cp39-cp39-win32.whl", hash = "sha256:cbff457659568f46fbbb8e594644278b51efddb532890117b4965b8c059d4d4a"}, + {file = "tarina-0.6.8-cp39-cp39-win_amd64.whl", hash = "sha256:bace5eeaed47048e9a8e9dd7953aadc11aace8c8a5db8457906d8f9c52604fc5"}, + {file = "tarina-0.6.8-py3-none-any.whl", hash = "sha256:0e8a04eecb741937244d97da54f8cd36995819fc12a6b60c9b3f3f3d2860ebe6"}, + {file = "tarina-0.6.8.tar.gz", hash = "sha256:d77d68948967a130066b61e85b21189259030f80ad19295bd81ff6b52f348316"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 4bb42b9..f6b2b1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ dependencies = [ "typing-extensions>=4.5.0", "nepattern<1.1.0,>=1.0.1", - "tarina<0.7.0,>=0.6.1", + "tarina<0.7.0,>=0.6.8", "elaina-segment>=0.4.0", "elaina-flywheel>=0.6.0", ] @@ -37,6 +37,8 @@ classifiers=[ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", ] [project.urls] diff --git a/src/arclet/alconna/__init__.py b/src/arclet/alconna/__init__.py index b2f34b4..309f039 100644 --- a/src/arclet/alconna/__init__.py +++ b/src/arclet/alconna/__init__.py @@ -39,4 +39,4 @@ from .shortcut import ShortcutArgs as ShortcutArgs from .manager import command_manager as command_manager -__version__ = "1.8.34" +__version__ = "1.8.35" diff --git a/src/arclet/alconna/core.py b/src/arclet/alconna/core.py index d3a471a..2cd3a04 100644 --- a/src/arclet/alconna/core.py +++ b/src/arclet/alconna/core.py @@ -112,7 +112,7 @@ def _(command: Alconna, arp: Arparma): trigger ): prompt_other = i18n.require("completion.prompt_other") - node = i18n.require('completion', 'node') + node = i18n.require("completion.node") node = f"{node}\n" if node else "" arp.output = f"{node}{prompt_other}" + f"\n{prompt_other}".join([i.text for i in res]) return True diff --git a/src/arclet/alconna/i18n/.config.json b/src/arclet/alconna/i18n/.config.json index 812c076..469c112 100644 --- a/src/arclet/alconna/i18n/.config.json +++ b/src/arclet/alconna/i18n/.config.json @@ -1,9 +1,13 @@ { "default": "zh-CN", - "frozen": [ - "alconna.builtin" - ], - "require": [ - "alconna.builtin" - ] + "frozen": { + "alconna": [ + "builtin" + ] + }, + "require": { + "alconna": [ + "builtin" + ] + } } \ No newline at end of file diff --git a/src/arclet/alconna/i18n/.lang.schema.json b/src/arclet/alconna/i18n/.lang.schema.json index 20fa834..6ae51df 100644 --- a/src/arclet/alconna/i18n/.lang.schema.json +++ b/src/arclet/alconna/i18n/.lang.schema.json @@ -38,6 +38,11 @@ "description": "value of lang item type 'node'", "type": "string" }, + "prompt_arg": { + "title": "prompt_arg", + "description": "value of lang item type 'prompt_arg'", + "type": "string" + }, "prompt_select": { "title": "prompt_select", "description": "value of lang item type 'prompt_select'", diff --git a/src/arclet/alconna/i18n/.template.json b/src/arclet/alconna/i18n/.template.json index cbb4c03..c0a1c49 100644 --- a/src/arclet/alconna/i18n/.template.json +++ b/src/arclet/alconna/i18n/.template.json @@ -16,6 +16,7 @@ "subtype": "completion", "types": [ "node", + "prompt_arg", "prompt_select", "prompt_other", "prompt_empty", diff --git a/src/arclet/alconna/i18n/en-US.json b/src/arclet/alconna/i18n/en-US.json index d12a675..0a6ffea 100644 --- a/src/arclet/alconna/i18n/en-US.json +++ b/src/arclet/alconna/i18n/en-US.json @@ -7,6 +7,7 @@ }, "completion": { "node": "suggest input follows:", + "prompt_arg": "{name}: {prompt}", "prompt_select": ">> ", "prompt_other": "* ", "prompt_empty": "No prompt available.", diff --git a/src/arclet/alconna/i18n/zh-CN.json b/src/arclet/alconna/i18n/zh-CN.json index 5eded9f..63ec2a0 100644 --- a/src/arclet/alconna/i18n/zh-CN.json +++ b/src/arclet/alconna/i18n/zh-CN.json @@ -7,6 +7,7 @@ }, "completion": { "node": "以下是建议的输入:", + "prompt_arg": "{name}: {prompt}", "prompt_select": ">> ", "prompt_other": "* ", "prompt_empty": "没有可用的补全提示", diff --git a/src/arclet/alconna/ingedia/_argv.py b/src/arclet/alconna/ingedia/_argv.py index d58a4a0..2a261ef 100644 --- a/src/arclet/alconna/ingedia/_argv.py +++ b/src/arclet/alconna/ingedia/_argv.py @@ -3,7 +3,6 @@ from dataclasses import InitVar, dataclass, field, fields from typing import Any, Callable, ClassVar, Generic, Iterable, Literal from typing_extensions import Self -from contextvars import ContextVar from tarina import split, split_once from ..i18n import i18n diff --git a/src/arclet/alconna/prompt.py b/src/arclet/alconna/prompt.py index d5147f3..dadf538 100644 --- a/src/arclet/alconna/prompt.py +++ b/src/arclet/alconna/prompt.py @@ -6,6 +6,7 @@ from .arparma import Arparma from .base import Subcommand, SPECIAL_OPTIONS, Option from .args import Arg +from .i18n import i18n if TYPE_CHECKING: from .core import Alconna @@ -27,12 +28,13 @@ class EnterResult: def _prompt_none(command: Alconna, args_got: list[str], opts_got: list[tuple[str, ...]]): res: list[Prompt] = [] if unit := next((arg for arg in command.args if arg.name not in args_got), None): + template = i18n.require("completion.prompt_arg") if not (comp := unit.field.get_completion()): res.append(Prompt(command.formatter.param(unit), False)) elif isinstance(comp, str): - res.append(Prompt(f"{unit.name}: {comp}", False)) + res.append(Prompt(template.format(name=unit.name, prompt=comp), False)) else: - res.extend(Prompt(f"{unit.name}: {i}", False) for i in comp) + res.extend(Prompt(template.format(name=unit.name, prompt=i), False) for i in comp) for opt in command.options: if isinstance(opt, SPECIAL_OPTIONS): continue @@ -47,12 +49,13 @@ def prompt(command: Alconna, buffer: list, args_got: list[str], opts_got: list[t if isinstance(buffer[-1], str) and buffer[-1] in command.config.builtin_option_name["completion"]: target = str(buffer[-2]) if isinstance(trigger, Arg): + template = i18n.require("completion.prompt_arg") if not (comp := trigger.field.get_completion()): return [Prompt(command.formatter.param(trigger), False)] if isinstance(comp, str): - return [Prompt(f"{trigger.name}: {comp}", False)] + return [Prompt(template.format(name=trigger.name, prompt=comp), False)] o = list(filter(lambda x: target in x, comp)) or comp - return [Prompt(f"{trigger.name}: {i}", False, target) for i in o] + return [Prompt(template.format(name=trigger.name, prompt=i), False, target) for i in o] elif isinstance(trigger, Subcommand): return [Prompt(i, True) for i in trigger._lookup_map if target in i] if isinstance(trigger, str):