From b1e44c590197262fdde2d0fb3904e378e48add34 Mon Sep 17 00:00:00 2001 From: abgox Date: Mon, 12 Aug 2024 18:50:10 +0800 Subject: [PATCH] feat(completions): update psc --- completions/psc/guid.txt | 2 +- completions/psc/language/en-US.json | 44 ++++++++++++++++++++++------- completions/psc/language/zh-CN.json | 38 ++++++++++++++++++++----- 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/completions/psc/guid.txt b/completions/psc/guid.txt index e5f201a..ae1929e 100644 --- a/completions/psc/guid.txt +++ b/completions/psc/guid.txt @@ -1 +1 @@ -e3bfe32c-0c75-4d54-8a4b-f1e78ee48ab0 +00c11c0d-1904-4603-9e57-38717e60e21d diff --git a/completions/psc/language/en-US.json b/completions/psc/language/en-US.json index 73f4b1e..d66062d 100644 --- a/completions/psc/language/en-US.json +++ b/completions/psc/language/en-US.json @@ -284,6 +284,21 @@ "tip": ["An available url.\n", "(Generated by Github Pages)"] } ] + }, + { + "name": "function_name", + "symbol": "SpaceTab", + "tip": [ + "Current Value: {{ $PSCompletions.config.function_name }}\n", + "Set the name of the core function exported by PSCompletions. (The change takes effect after restarting PowerShell and importing PSCompletions module.)\n", + "When you need to define a function called PSCompletions, you can use this configuration to change the default exported function name of the PSCompletions module to resolve conflicts." + ], + "next": [ + { + "name": "PSCompletions", + "tip": "Set to PSCompletions (Default)" + } + ] } ] }, @@ -865,7 +880,7 @@ "symbol": "SpaceTab", "tip": [ "当前值: \"{{ $PSCompletions.config.menu_trigger_key }}\" (Default: \"Tab\")\n", - "Setting the key that triggers the completion menu. (You should restart PowerShell after changing this configuration.)" + "Setting the key that triggers the completion menu. (The change takes effect after restarting PowerShell and importing PSCompletions module.)" ], "next": [ { @@ -1116,7 +1131,7 @@ "symbol": "SpaceTab", "tip": [ "Current Value: {{ $PSCompletions.config.menu_enhance }} (Default 1, it means enabled)\n", - "Set whether to override PowerShell's built-in completion menu. (You should restart PowerShell after changing this configuration.)\n", + "Set whether to override PowerShell's built-in completion menu. (The change takes effect after restarting PowerShell and importing PSCompletions module.)\n", "More info: https://github.com/abgox/PSCompletions/blob/main/README.md#about-menu-enhance\n", " https://gitee.com/abgox/PSCompletions/blob/main/README.md#about-menu-enhance\n" ], @@ -1287,15 +1302,15 @@ " Gitee : <@Blue>https://gitee.com/abgox/PSCompletions/blob/main/module/CHANGELOG.md<@Cyan>\n", "\n", "<@Blue>PSCompletions<@Cyan> is simple, you just need to enter <@Magenta>psc<@Cyan>, press <@Magenta>Space<@Cyan> and <@Magenta>Tab<@Cyan> key, you will quickly learn all usages by reading the completion tip.\n", - "Now, enter <@Magenta>psc add<@Cyan>, press <@Magenta>Space<@Cyan> and <@Magenta>Tab<@Cyan> key, and add the first completion!\n", "\n", - "<@Blue>PSCompletions<@Cyan> will take up two global names. (<@Yellow>You can't modify them.<@Cyan>)\n", + "<@Blue>PSCompletions<@Cyan> will take up two global names.\n", " <@Magenta>PSCompletions<@Cyan> => A function name. The core function of the module export. (<@Magenta>psc<@Cyan> is actually its alias.)\n", - " <@Magenta>$PSCompletions<@Cyan> => A variable name. Save all information related to the module.\n", + " <@Magenta>$PSCompletions<@Cyan> => A variable name. Save all information related to the module. (<@Yellow>You can't modify it.<@Cyan>)\n", "\n", "For more information, please visit the project:\n", - " Github: <@Blue>https://github.com/abgox/PSCompletions<@Cyan>\n", - " Gitee : <@Blue>https://gitee.com/abgox/PSCompletions<@Cyan>\n", + " Website : <@Blue>https://pscompletions.pages.dev<@Cyan>\n", + " Github : <@Blue>https://github.com/abgox/PSCompletions<@Cyan>\n", + " Gitee : <@Blue>https://gitee.com/abgox/PSCompletions<@Cyan>\n", "When you have a problem using it, you can submit an issue. https://github.com/abgox/PSCompletions/issues\n", "If <@Blue>PSCompletions<@Cyan> is helpful to you, please consider giving it a <@Yellow>Star<@Cyan>.\n" ], @@ -1544,10 +1559,10 @@ "done": [ "{{", "if($arg[1] -eq 'add') {", - "\"<@Magenta>$($completion)<@Green> adds an alias <@Magenta>$($alias)<@Green>, Now <@Magenta>$($completion)<@Green>'s available aliases: <@Magenta>$($PSCompletions.cmd.$completion -join ' ') $($alias)`n<@Yellow>You need to restart PowerShell and re-import the PSCompletions module for the changes to take effect.\"", + "\"<@Magenta>$($completion)<@Green> adds an alias <@Magenta>$($alias)<@Green>, Now <@Magenta>$($completion)<@Green>'s available aliases: <@Magenta>$($PSCompletions.cmd.$completion -join ' ') $($alias)`n<@Yellow>The change takes effect after restarting PowerShell and importing PSCompletions module.\"", "}", "elseif($arg[1] -eq 'rm') {", - "\"<@Magenta>$($completion)<@Green> removes an alias <@Magenta>$($alias)<@Green>, Now <@Magenta>$($completion)<@Green>'s available aliases: <@Magenta>$(($PSCompletions.cmd.$completion | Where-Object { $_ -ne $alias }) -join ' ')`n<@Yellow>You need to restart PowerShell and re-import the PSCompletions module for the changes to take effect.\"", + "\"<@Magenta>$($completion)<@Green> removes an alias <@Magenta>$($alias)<@Green>, Now <@Magenta>$($completion)<@Green>'s available aliases: <@Magenta>$(($PSCompletions.cmd.$completion | Where-Object { $_ -ne $alias }) -join ' ')`n<@Yellow>The change takes effect after restarting PowerShell and importing PSCompletions module.\"", "}", "}}" ], @@ -1688,6 +1703,15 @@ "E: psc config url --- Get current url\n", " psc config url https://abgox.github.io/PSCompletions --- Set url" ] + }, + "function_name": { + "err": { + "max": "<@Magenta>{{ $config_item }}<@Yellow> need a value, and it cannot be an existing command." + }, + "example": [ + "E: psc config function_name --- Get current function name\n", + " psc config function_name PSCompletions --- Set function name" + ] } }, "completion": { @@ -1817,7 +1841,7 @@ ], "init_done": [ "<@Green>PSCompletions module was reset successfully!\n", - "<@Yellow>You need to restart PowerShell and re-import the PSCompletions module, which will re-initialize." + "<@Yellow>It will re-initialize after restarting PowerShell and importing PSCompletions module." ], "done": [ "{{", diff --git a/completions/psc/language/zh-CN.json b/completions/psc/language/zh-CN.json index 4bdf33a..5553919 100644 --- a/completions/psc/language/zh-CN.json +++ b/completions/psc/language/zh-CN.json @@ -264,6 +264,21 @@ "tip": ["一个可用的地址\n", "(通过 Github Pages 生成)"] } ] + }, + { + "name": "function_name", + "symbol": "SpaceTab", + "tip": [ + "当前值: {{ $PSCompletions.config.function_name }}\n", + "设置模块导出的核心函数名(修改后必须重启 PowerShell)\n", + "当你需要定义一个函数,且必须命名为 PSCompletions 时,你可以通过此配置修改 PSCompletions 模块默认导出的函数名以解决冲突" + ], + "next": [ + { + "name": "PSCompletions", + "tip": "设置为 PSCompletions (默认值)" + } + ] } ] }, @@ -1241,16 +1256,16 @@ " Github: <@Blue>https://github.com/abgox/PSCompletions/blob/main/module/CHANGELOG-CN.md<@Cyan>\n", " Gitee : <@Blue>https://gitee.com/abgox/PSCompletions/blob/main/module/CHANGELOG-CN.md<@Cyan>\n", "\n", - "本模块命令简单, 你只需要输入 <@Magenta>psc<@Cyan> 并按下 <@Magenta>空格<@Cyan> 和 <@Magenta>Tab<@Cyan> 键, 通过补全提示信息,你会快速了解所有命令用法。\n", - "现在,输入 <@Magenta>psc add<@Cyan> 并按下 <@Magenta>空格<@Cyan> 和 <@Magenta>Tab<@Cyan> 键,去添加第一个补全吧!\n", + "<@Blue>PSCompletions<@Cyan> 命令简单, 只需要输入 <@Magenta>psc<@Cyan> 并按下 <@Magenta>空格<@Cyan> 和 <@Magenta>Tab<@Cyan> 键, 通过补全提示信息,你会快速了解所有命令用法。\n", "\n", - "PSCompletions 模块只会占用两个全局命名(<@Yellow>你不能修改它们<@Cyan>)\n", + "<@Blue>PSCompletions<@Cyan> 模块只会占用两个全局命名\n", " <@Magenta>PSCompletions<@Cyan> => 函数名, 模块导出的核心函数(<@Magenta>psc<@Cyan> 其实就是它的别名)\n", - " <@Magenta>$PSCompletions<@Cyan> => 变量名, 存储模块相关的所有信息\n", + " <@Magenta>$PSCompletions<@Cyan> => 变量名, 存储模块相关的所有信息(<@Yellow>你不能修改它<@Cyan>)\n", "\n", - "更多相关信息, 请访问项目:\n", - " Github: <@Blue>https://github.com/abgox/PSCompletions<@Cyan>\n", - " Gitee : <@Blue>https://gitee.com/abgox/PSCompletions<@Cyan>\n", + "更多相关信息, 请访问:\n", + " Website : <@Blue>https://pscompletions.pages.dev<@Cyan>\n", + " Github : <@Blue>https://github.com/abgox/PSCompletions<@Cyan>\n", + " Gitee : <@Blue>https://gitee.com/abgox/PSCompletions<@Cyan>\n", "如果有使用问题, 请提交 issue: https://github.com/abgox/PSCompletions/issues\n", "如果 <@Blue>PSCompletions<@Cyan> 对你有所帮助, 请给这个项目点个 <@Yellow>Star<@>\n" ], @@ -1642,6 +1657,15 @@ "E: psc config url --- 获取当前使用的 url\n", " psc config url https://abgox.github.io/PSCompletions --- 设置 url 地址" ] + }, + "function_name": { + "err": { + "max": "<@Magenta>{{ $config_item }}<@Yellow> 配置项需要一个值, 且它不是已存在的命令" + }, + "example": [ + "E: psc config function_name --- 获取当前使用的函数名\n", + " psc config function_name PSCompletions --- 设置函数名" + ] } }, "completion": {