@clerc/plugin-completions 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/dist/index.js +9 -7
  3. package/package.json +5 -5
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Ray <https://github.com/so1ve>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Ray <https://github.com/so1ve>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@ const generateCommandCompletion = (name) => `
5
5
  ${name})
6
6
  cmd+="__${name}"
7
7
  ;;`;
8
- function getBashCompletion(ctx) {
9
- const { cli } = ctx;
8
+ function getBashCompletion(context) {
9
+ const { cli } = context;
10
10
  const { _scriptName: name, _commands: commands } = cli;
11
11
  return `_${name}() {
12
12
  local i cur prev opts cmds
@@ -51,8 +51,8 @@ const getCompletionFlag = (command) => {
51
51
  return gen.join("\n ");
52
52
  }).join("\n ");
53
53
  };
54
- function getPwshCompletion(ctx) {
55
- const { cli } = ctx;
54
+ function getPwshCompletion(context) {
55
+ const { cli } = context;
56
56
  const { _scriptName: name, _commands: commands } = cli;
57
57
  return `using namespace System.Management.Automation
58
58
  using namespace System.Management.Automation.Language
@@ -109,18 +109,20 @@ const completionsPlugin = (options = {}) => definePlugin({
109
109
  }
110
110
  },
111
111
  parameters: ["[shell]"]
112
- }).on("completions", (ctx) => {
112
+ }).on("completions", (context) => {
113
113
  var _a;
114
114
  if (!cli._scriptName) {
115
115
  throw new Error("CLI name is not defined!");
116
116
  }
117
- const shell = String((_a = ctx.parameters.shell) != null ? _a : ctx.flags.shell);
117
+ const shell = String(
118
+ (_a = context.parameters.shell) != null ? _a : context.flags.shell
119
+ );
118
120
  if (!shell) {
119
121
  throw new Error("Missing shell name");
120
122
  }
121
123
  if (shell in completionMap) {
122
124
  process.stdout.write(
123
- completionMap[shell](ctx)
125
+ completionMap[shell](context)
124
126
  );
125
127
  } else {
126
128
  throw new Error(`No such shell: ${shell}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-completions",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin completions",
@@ -13,14 +13,14 @@
13
13
  "cli",
14
14
  "terminal"
15
15
  ],
16
- "homepage": "https://github.com/so1ve/clerc/tree/main/packages/plugin-completions#readme",
16
+ "homepage": "https://github.com/clercjs/clerc/tree/main/packages/plugin-completions#readme",
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "git+https://github.com/so1ve/clerc.git",
19
+ "url": "git+https://github.com/clercjs/clerc.git",
20
20
  "directory": "/"
21
21
  },
22
22
  "bugs": {
23
- "url": "https://github.com/so1ve/clerc/issues"
23
+ "url": "https://github.com/clercjs/clerc/issues"
24
24
  },
25
25
  "license": "MIT",
26
26
  "sideEffects": false,
@@ -48,7 +48,7 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@clerc/utils": "0.41.0"
51
+ "@clerc/utils": "0.42.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@clerc/core": "*"