@optique/git 0.9.0-dev.254 → 0.9.0-dev.256

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.
package/dist/index.cjs CHANGED
@@ -54,14 +54,6 @@ function listFailureMessage(error, dir, errors, fallback) {
54
54
  if (hasErrorCode(error, "NotAGitRepositoryError") || hasErrorCode(error, "NotFoundError")) return __optique_core_message.message`${(0, __optique_core_message.value)(dir)} is not a git repository.`;
55
55
  return fallback;
56
56
  }
57
- function formatChoiceList(choices) {
58
- let result = [];
59
- for (let i = 0; i < choices.length; i++) {
60
- if (i > 0) result = [...result, ...__optique_core_message.message`, `];
61
- result = [...result, ...__optique_core_message.message`${choices[i]}`];
62
- }
63
- return result;
64
- }
65
57
  function createAsyncValueParser(options, metavar, parseFn, suggestFn) {
66
58
  (0, __optique_core_nonempty.ensureNonEmptyString)(metavar);
67
59
  return {
@@ -116,7 +108,7 @@ function gitBranch(options) {
116
108
  };
117
109
  return {
118
110
  success: false,
119
- error: __optique_core_message.message`Branch ${(0, __optique_core_message.value)(input)} does not exist. Available branches: ${formatChoiceList(branches)}`
111
+ error: __optique_core_message.message`Branch ${(0, __optique_core_message.value)(input)} does not exist. Available branches: ${(0, __optique_core_message.valueSet)(branches)}`
120
112
  };
121
113
  } catch (error) {
122
114
  const fallback = __optique_core_message.message`Failed to list branches. Ensure ${(0, __optique_core_message.value)(dir)} is a valid git repository.`;
@@ -176,7 +168,7 @@ function gitRemoteBranch(remote, options) {
176
168
  };
177
169
  return {
178
170
  success: false,
179
- error: __optique_core_message.message`Remote branch ${(0, __optique_core_message.value)(input)} does not exist on remote ${(0, __optique_core_message.value)(remote)}. Available branches: ${formatChoiceList(branches)}`
171
+ error: __optique_core_message.message`Remote branch ${(0, __optique_core_message.value)(input)} does not exist on remote ${(0, __optique_core_message.value)(remote)}. Available branches: ${(0, __optique_core_message.valueSet)(branches)}`
180
172
  };
181
173
  } catch (error) {
182
174
  const fallback = __optique_core_message.message`Failed to list remote branches. Ensure remote ${(0, __optique_core_message.value)(remote)} exists.`;
@@ -224,7 +216,7 @@ function gitTag(options) {
224
216
  };
225
217
  return {
226
218
  success: false,
227
- error: __optique_core_message.message`Tag ${(0, __optique_core_message.value)(input)} does not exist. Available tags: ${formatChoiceList(tags)}`
219
+ error: __optique_core_message.message`Tag ${(0, __optique_core_message.value)(input)} does not exist. Available tags: ${(0, __optique_core_message.valueSet)(tags)}`
228
220
  };
229
221
  } catch (error) {
230
222
  const fallback = __optique_core_message.message`Failed to list tags. Ensure ${(0, __optique_core_message.value)(dir)} is a valid git repository.`;
@@ -272,7 +264,7 @@ function gitRemote(options) {
272
264
  };
273
265
  return {
274
266
  success: false,
275
- error: __optique_core_message.message`Remote ${(0, __optique_core_message.value)(input)} does not exist. Available remotes: ${formatChoiceList(names)}`
267
+ error: __optique_core_message.message`Remote ${(0, __optique_core_message.value)(input)} does not exist. Available remotes: ${(0, __optique_core_message.valueSet)(names)}`
276
268
  };
277
269
  } catch (error) {
278
270
  const fallback = __optique_core_message.message`Failed to list remotes. Ensure ${(0, __optique_core_message.value)(dir)} is a valid git repository.`;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { message, value } from "@optique/core/message";
1
+ import { message, value, valueSet } from "@optique/core/message";
2
2
  import { ensureNonEmptyString } from "@optique/core/nonempty";
3
3
  import * as git from "isomorphic-git";
4
4
  import { expandOid, listBranches, listRemotes, listTags, readObject, resolveRef } from "isomorphic-git";
@@ -32,14 +32,6 @@ function listFailureMessage(error, dir, errors, fallback) {
32
32
  if (hasErrorCode(error, "NotAGitRepositoryError") || hasErrorCode(error, "NotFoundError")) return message`${value(dir)} is not a git repository.`;
33
33
  return fallback;
34
34
  }
35
- function formatChoiceList(choices) {
36
- let result = [];
37
- for (let i = 0; i < choices.length; i++) {
38
- if (i > 0) result = [...result, ...message`, `];
39
- result = [...result, ...message`${choices[i]}`];
40
- }
41
- return result;
42
- }
43
35
  function createAsyncValueParser(options, metavar, parseFn, suggestFn) {
44
36
  ensureNonEmptyString(metavar);
45
37
  return {
@@ -94,7 +86,7 @@ function gitBranch(options) {
94
86
  };
95
87
  return {
96
88
  success: false,
97
- error: message`Branch ${value(input)} does not exist. Available branches: ${formatChoiceList(branches)}`
89
+ error: message`Branch ${value(input)} does not exist. Available branches: ${valueSet(branches)}`
98
90
  };
99
91
  } catch (error) {
100
92
  const fallback = message`Failed to list branches. Ensure ${value(dir)} is a valid git repository.`;
@@ -154,7 +146,7 @@ function gitRemoteBranch(remote, options) {
154
146
  };
155
147
  return {
156
148
  success: false,
157
- error: message`Remote branch ${value(input)} does not exist on remote ${value(remote)}. Available branches: ${formatChoiceList(branches)}`
149
+ error: message`Remote branch ${value(input)} does not exist on remote ${value(remote)}. Available branches: ${valueSet(branches)}`
158
150
  };
159
151
  } catch (error) {
160
152
  const fallback = message`Failed to list remote branches. Ensure remote ${value(remote)} exists.`;
@@ -202,7 +194,7 @@ function gitTag(options) {
202
194
  };
203
195
  return {
204
196
  success: false,
205
- error: message`Tag ${value(input)} does not exist. Available tags: ${formatChoiceList(tags)}`
197
+ error: message`Tag ${value(input)} does not exist. Available tags: ${valueSet(tags)}`
206
198
  };
207
199
  } catch (error) {
208
200
  const fallback = message`Failed to list tags. Ensure ${value(dir)} is a valid git repository.`;
@@ -250,7 +242,7 @@ function gitRemote(options) {
250
242
  };
251
243
  return {
252
244
  success: false,
253
- error: message`Remote ${value(input)} does not exist. Available remotes: ${formatChoiceList(names)}`
245
+ error: message`Remote ${value(input)} does not exist. Available remotes: ${valueSet(names)}`
254
246
  };
255
247
  } catch (error) {
256
248
  const fallback = message`Failed to list remotes. Ensure ${value(dir)} is a valid git repository.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/git",
3
- "version": "0.9.0-dev.254+390a74da",
3
+ "version": "0.9.0-dev.256+2840ea5d",
4
4
  "description": "Git value parsers for Optique",
5
5
  "keywords": [
6
6
  "CLI",