@clerc/plugin-completions 0.42.0 → 0.42.2

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 (2) hide show
  1. package/dist/index.js +7 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@ const generateCommandCompletion = (name) => `
5
5
  ${name})
6
6
  cmd+="__${name}"
7
7
  ;;`;
8
- function getBashCompletion(context) {
9
- const { cli } = context;
8
+ function getBashCompletion(ctx) {
9
+ const { cli } = ctx;
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(context) {
55
- const { cli } = context;
54
+ function getPwshCompletion(ctx) {
55
+ const { cli } = ctx;
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,20 +109,18 @@ const completionsPlugin = (options = {}) => definePlugin({
109
109
  }
110
110
  },
111
111
  parameters: ["[shell]"]
112
- }).on("completions", (context) => {
112
+ }).on("completions", (ctx) => {
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(
118
- (_a = context.parameters.shell) != null ? _a : context.flags.shell
119
- );
117
+ const shell = String((_a = ctx.parameters.shell) != null ? _a : ctx.flags.shell);
120
118
  if (!shell) {
121
119
  throw new Error("Missing shell name");
122
120
  }
123
121
  if (shell in completionMap) {
124
122
  process.stdout.write(
125
- completionMap[shell](context)
123
+ completionMap[shell](ctx)
126
124
  );
127
125
  } else {
128
126
  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.42.0",
3
+ "version": "0.42.2",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin completions",
@@ -48,7 +48,7 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@clerc/utils": "0.42.0"
51
+ "@clerc/utils": "0.42.2"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@clerc/core": "*"