@deslop/stash 0.1.1066 → 0.1.1069
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/README.md +2 -2
- package/dist/cli.js +524 -256
- package/dist/{contracts-CoHsVor4.mjs → contracts-gJqVIC2c.mjs} +5744 -2910
- package/dist/server.js +74000 -63414
- package/package.json +8 -7
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { $ as
|
|
3
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
2
|
+
import { $d as identity, $n as value, $o as runForkWith, Ao as match$2, Ba as catchCauseIf, Bo as orDie, Bs as isEmpty, Cs as void_, Ct as Defect, D as option, Do as map$2, Dt as FalseLiterals, Ei as runHead, El as taggedEnum, Eo as makeSpanScoped, Fi as unwrap, Fl as filter$1, Fo as onError, Ft as NonEmptyArray, Fu as Reference, Ga as catchTag, Gi as bounded, Go as provideService, Ha as catchFilter, Hu as getUnsafe, I as layerJson, Ic as Scope, Iu as Service, J as isStreamSchema, Ja as context, Ji as failCause, Ju as exists, Ka as catchTags, Ks as replace, La as cached, Lc as addFinalizer, Ld as hasProperty, Ll as findFirst, Lu as add, Ml as empty$2, Ms as min, N as withRunClient, Na as annotateLogs, Nd as format, Ns as spaced, Os as withParentSpan, Ou as succeed$2, P as RpcSerialization, Pu as toMillis, Q as makeCollectorUnsafe, Qa as ensuring, Qn as make$2, R as RequestId, Ra as callback, Rc as addFinalizerExit, Rl as findFirstIndex, Ro as onInterrupt, Ru as empty$1, Sn as tag, So as logError, Ss as useSpan, Td as assignProperty, Ts as withFiber, Tt as Error$1, Tu as isSuccess, Un as empty, Uo as provide, Ut as TaggedError, Uu as make$3, V as constPing, Vd as isNotUndefined, Vs as isNonEmpty, Vt as String$6, Vu as getOrUndefinedUnsafe, W as exitSchema, Wn as fromInput, Wo as provideContext, Wt as TrueLiterals, X as spanName, Xa as delay, Xl as isReadonlyArrayNonEmpty, Y as spanAttributes, Yd as constVoid, Yo as result, Z as Collector, Zd as dual, Zi as offerAll, Zl as join, Zo as retryOrElse, Zr as filter, Zt as Union, _ as QuitError, _c as interruptors, _o as interrupt$1, _t as ArraySchema, aa as makeUnsafe, ad as isSome, ai as fromQueue, al as isFailure, as as succeed$1, bd as Prototype, bn as optional$2, c as NotesError, ca as interrupt$2, cd as map$3, cl as ConsoleRef, co as forever, cs as sync$1, do as forkScoped, ea as shutdownUnsafe, ed as fromUndefinedOr, ef as pipe, el as die, en as decodeSync, eo as fail$1, et as Socket, eu as map$4, fc as findError, fs as timeout, ft as HttpClientErrorSchema, g as layer, gl as sync, go as ignoreCause, h as errorReported, hc as hasInterrupts, ho as ignore, id as isNone, in as encodeEffect, is as serviceOption, it as SocketReadError, iu as reduce, j as Stdio, ja as andThen, jc as provide$1, jo as matchCauseEffect, js as exponential, jt as Literal, ko as mapError, ld as match$1, ln as is, m as errorExitCode, mo as gen, ms as timeoutOrElse, nc as round, nl as failCause$1, nn as decodeUnknownEffect, ns as scoped, nt as SocketErrorReason, oo as fnUntraced, ot as layerWebSocket, ou as some$1, p as runMain, pd as some, q as getStreamSchemas, qc as MinimumLogLevel, qi as end, qn as merge, qo as raceFirst, rc as Clock, rd as getOrUndefined, rl as interrupt, ro as flatMap$1, sa as getCurrent, so as forEach, ss as suspend, st as layerWebSocketConstructorGlobal, t as RpcContracts, ta as take, td as getOrElse, tf as pipeArguments, tl as fail, tt as SocketError, tu as match, u as LogToStderr, ud as none, uo as forkIn, us as tapCause, v as Terminal, vo as interruptible, w as String$7, wc as effect, wd as withFiber$1, wn as toCodecStringTree, wo as logInfo, ws as whileLoop, x as Crypto, xc as squash, xn as optionalKey, y as isQuitError, yo as isEffect, ys as uninterruptibleMask, yt as BooleanLiterals, yu as fail$2, za as catchCause, zl as findLast, zu as get } from "./contracts-gJqVIC2c.mjs";
|
|
3
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/workers/WorkerError.js
|
|
4
4
|
/**
|
|
5
5
|
* Worker error reason for failures while spawning or setting up a worker.
|
|
6
6
|
*
|
|
@@ -64,7 +64,7 @@ const WorkerErrorReason = /*#__PURE__*/ Union([
|
|
|
64
64
|
WorkerUnknownError
|
|
65
65
|
]);
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
67
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/rpc/RpcClientError.js
|
|
68
68
|
/**
|
|
69
69
|
* Client-side protocol failures reported by unstable RPC transports.
|
|
70
70
|
*
|
|
@@ -119,7 +119,7 @@ var RpcClientError = class extends (/*#__PURE__*/ Error$1(TypeId$4)({
|
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
//#endregion
|
|
122
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
122
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/rpc/RpcClient.js
|
|
123
123
|
let requestIdCounter = 0;
|
|
124
124
|
/**
|
|
125
125
|
* Creates an RPC client for an already-decoded message channel, returning the
|
|
@@ -165,7 +165,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
165
165
|
}
|
|
166
166
|
const queue = onStreamRequest(rpc, middleware, rpc.payloadSchema.make(payload), headers, opts?.streamBufferSize ?? 16, context);
|
|
167
167
|
if (opts?.asQueue) return queue;
|
|
168
|
-
return unwrap(map$
|
|
168
|
+
return unwrap(map$2(queue, fromQueue));
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
const onEffectRequest = (rpc, middleware, span, payload, headers, context, discard) => withFiber((parentFiber) => {
|
|
@@ -458,7 +458,7 @@ const makeRpcSchemas = (codecFor) => {
|
|
|
458
458
|
if (entry !== void 0) return entry;
|
|
459
459
|
const streamSchemas = getStreamSchemas(rpc.successSchema);
|
|
460
460
|
entry = {
|
|
461
|
-
decodeChunk: map$
|
|
461
|
+
decodeChunk: map$3(streamSchemas, (streamSchemas) => decodeUnknownEffect(codecFor(NonEmptyArray(streamSchemas.success)))),
|
|
462
462
|
encodePayload: encodeEffect(codecFor(rpc.payloadSchema)),
|
|
463
463
|
decodeExit: decodeUnknownEffect(codecFor(exitSchema(rpc)))
|
|
464
464
|
};
|
|
@@ -525,6 +525,10 @@ const makeProtocolSocket = (options) => Protocol.make(fnUntraced(function* (writ
|
|
|
525
525
|
const writer = yield* socket.writer;
|
|
526
526
|
let parser = serialization.makeUnsafe();
|
|
527
527
|
const pinger = yield* makePinger(suspend(() => writer.write(parser.encode(constPing))), options);
|
|
528
|
+
const onPingTimeout = ignoreCause(options?.onPingTimeout ?? void_, {
|
|
529
|
+
log: true,
|
|
530
|
+
message: "RpcClient onPingTimeout hook failed"
|
|
531
|
+
});
|
|
528
532
|
let currentError;
|
|
529
533
|
const broadcast = (response) => forEach(clientIds, (clientId) => writeResponse(clientId, response));
|
|
530
534
|
const broadcastError = (error) => {
|
|
@@ -570,15 +574,17 @@ const makeProtocolSocket = (options) => Protocol.make(fnUntraced(function* (writ
|
|
|
570
574
|
yield* suspend(() => {
|
|
571
575
|
parser = serialization.makeUnsafe();
|
|
572
576
|
pinger.reset();
|
|
577
|
+
let connected = false;
|
|
573
578
|
return gen(function* () {
|
|
574
579
|
const { pull } = yield* socket.reader;
|
|
575
580
|
currentError = void 0;
|
|
581
|
+
connected = true;
|
|
576
582
|
if (isSome(hooks)) yield* hooks.value.onConnect;
|
|
577
583
|
while (true) {
|
|
578
584
|
const frames = yield* pull;
|
|
579
585
|
for (let i = 0; i < frames.length; i++) yield* processData(frames[i]);
|
|
580
586
|
}
|
|
581
|
-
}).pipe(scoped, raceFirst(
|
|
587
|
+
}).pipe(scoped, raceFirst(pinger.timeout), andThen(() => connected ? onPingTimeout : void_), andThen(() => fail$1(new SocketError({ reason: new SocketReadError({ cause: /* @__PURE__ */ new Error("ping timeout") }) }))));
|
|
582
588
|
}).pipe(isSome(hooks) ? ensuring(hooks.value.onDisconnect) : identity, tapCause((cause) => {
|
|
583
589
|
const error = findError(cause);
|
|
584
590
|
const hasError = isSuccess(error);
|
|
@@ -663,7 +669,7 @@ const layerProtocolSocket = (options) => effect(Protocol)(makeProtocolSocket(opt
|
|
|
663
669
|
*/
|
|
664
670
|
var ConnectionHooks = class extends (/*#__PURE__*/ Service()("effect/rpc/RpcClient/ConnectionHooks")) {};
|
|
665
671
|
//#endregion
|
|
666
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
672
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Console.js
|
|
667
673
|
/**
|
|
668
674
|
* Context reference for the current console service in the Effect system, allowing access to the active console implementation from within the Effect context.
|
|
669
675
|
*
|
|
@@ -802,7 +808,7 @@ const log = (...args) => consoleWith((console) => sync(() => {
|
|
|
802
808
|
console.log(...args);
|
|
803
809
|
}));
|
|
804
810
|
//#endregion
|
|
805
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
811
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/CliError.js
|
|
806
812
|
/**
|
|
807
813
|
* Defines structured errors for the unstable CLI parser and runner.
|
|
808
814
|
*
|
|
@@ -1332,7 +1338,7 @@ var ShowHelp = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/ShowHelp`)(
|
|
|
1332
1338
|
}
|
|
1333
1339
|
};
|
|
1334
1340
|
//#endregion
|
|
1335
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1341
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Primitive.js
|
|
1336
1342
|
/**
|
|
1337
1343
|
* Parses raw command-line strings into typed values.
|
|
1338
1344
|
*
|
|
@@ -1571,7 +1577,7 @@ const getChoiceKeys = (primitive) => primitive._tag === "Choice" ? primitive.cho
|
|
|
1571
1577
|
*/
|
|
1572
1578
|
const getPathType = (primitive) => primitive._tag === "Path" ? primitive.pathType : void 0;
|
|
1573
1579
|
//#endregion
|
|
1574
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1580
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/ansi.js
|
|
1575
1581
|
/**
|
|
1576
1582
|
* Internal ANSI escape sequence helpers used by the unstable CLI rendering
|
|
1577
1583
|
* implementation. This module centralizes the control codes for text styling,
|
|
@@ -1655,9 +1661,27 @@ const blackBright = `${ESC}90m`;
|
|
|
1655
1661
|
* @internal
|
|
1656
1662
|
*/
|
|
1657
1663
|
const cyanBright = `${ESC}96m`;
|
|
1658
|
-
|
|
1664
|
+
/**
|
|
1665
|
+
* Wraps `text` in the given styles followed by a reset. When `colors` is
|
|
1666
|
+
* `false` the text is returned unchanged, so callers gate color and style
|
|
1667
|
+
* escapes in one place while cursor and erase controls stay untouched.
|
|
1668
|
+
*
|
|
1669
|
+
* @internal
|
|
1670
|
+
*/
|
|
1671
|
+
const annotate = (colors, text, ...styles) => {
|
|
1672
|
+
if (!colors) return text;
|
|
1659
1673
|
return `${styles.flat().join("")}${text}${reset}`;
|
|
1660
1674
|
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Detects whether CLI output should use color and style escapes: stdout must
|
|
1677
|
+
* be a TTY and `NO_COLOR` must be unset or empty.
|
|
1678
|
+
*
|
|
1679
|
+
* @internal
|
|
1680
|
+
*/
|
|
1681
|
+
const detectColors = () => {
|
|
1682
|
+
const globalProcess = globalThis.process;
|
|
1683
|
+
return typeof globalProcess === "object" && globalProcess !== null && typeof globalProcess.stdout === "object" && globalProcess.stdout !== null && globalProcess.stdout.isTTY === true && !globalProcess.env?.NO_COLOR;
|
|
1684
|
+
};
|
|
1661
1685
|
const combine = (...styles) => styles;
|
|
1662
1686
|
/**
|
|
1663
1687
|
* @internal
|
|
@@ -1693,7 +1717,7 @@ const eraseLines = (rows) => {
|
|
|
1693
1717
|
return command;
|
|
1694
1718
|
};
|
|
1695
1719
|
//#endregion
|
|
1696
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1720
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Prompt.js
|
|
1697
1721
|
/**
|
|
1698
1722
|
* Builds interactive terminal prompts for CLI applications.
|
|
1699
1723
|
*
|
|
@@ -1739,13 +1763,19 @@ const windowsTheme = {
|
|
|
1739
1763
|
/**
|
|
1740
1764
|
* Creates a prompt theme using the current platform defaults.
|
|
1741
1765
|
*
|
|
1766
|
+
* **Details**
|
|
1767
|
+
*
|
|
1768
|
+
* Unless `colors` is provided, it is detected when the theme is created:
|
|
1769
|
+
* colors are enabled when stdout is a TTY and `NO_COLOR` is unset or empty.
|
|
1770
|
+
*
|
|
1742
1771
|
* @stability unstable
|
|
1743
1772
|
* @category constructors
|
|
1744
1773
|
* @since 4.0.0
|
|
1745
1774
|
*/
|
|
1746
1775
|
const makeTheme = (options) => ({
|
|
1747
1776
|
...process.platform === "win32" ? windowsTheme : defaultTheme,
|
|
1748
|
-
...options
|
|
1777
|
+
...options,
|
|
1778
|
+
colors: options?.colors ?? detectColors()
|
|
1749
1779
|
});
|
|
1750
1780
|
/**
|
|
1751
1781
|
* Context reference for the theme used by built-in prompts.
|
|
@@ -1753,20 +1783,25 @@ const makeTheme = (options) => ({
|
|
|
1753
1783
|
* **Details**
|
|
1754
1784
|
*
|
|
1755
1785
|
* Provide this reference once to theme every prompt in an application. A
|
|
1756
|
-
* prompt's `theme` option takes precedence over the context value.
|
|
1786
|
+
* prompt's `theme` option takes precedence over the context value. The
|
|
1787
|
+
* command wizard also reads `colors` from this reference, so provide a theme
|
|
1788
|
+
* with `colors: false` to disable wizard styling.
|
|
1789
|
+
*
|
|
1790
|
+
* The default value is created with `makeTheme` the first time it is read,
|
|
1791
|
+
* so color detection runs once per process. Changes to `NO_COLOR` after the
|
|
1792
|
+
* first prompt do not affect the default theme.
|
|
1757
1793
|
*
|
|
1758
1794
|
* @stability unstable
|
|
1759
1795
|
* @category services
|
|
1760
1796
|
* @since 4.0.0
|
|
1761
1797
|
*/
|
|
1762
1798
|
const Theme = /*#__PURE__*/ Reference("effect/cli/Prompt/Theme", { defaultValue: makeTheme });
|
|
1763
|
-
const getTheme = (options) => map$
|
|
1799
|
+
const getTheme = (options) => map$2(Theme, (theme) => ({
|
|
1764
1800
|
...theme,
|
|
1765
1801
|
...options.theme
|
|
1766
1802
|
}));
|
|
1767
|
-
const
|
|
1768
|
-
const
|
|
1769
|
-
const annotateSymbol = (symbol, ...styles) => symbol.length === 0 ? "" : annotate(symbol, ...styles);
|
|
1803
|
+
const annotateErrorLine = (theme, line) => annotate(theme.colors, line, combine(italicized, theme.errorColor));
|
|
1804
|
+
const annotateSymbol = (theme, symbol, ...styles) => symbol.length === 0 ? "" : annotate(theme.colors, symbol, ...styles);
|
|
1770
1805
|
const separateSymbol = (symbol, text) => symbol.length === 0 ? text : symbol + " " + text;
|
|
1771
1806
|
const renderPagingPrefix = (theme, showArrowUp, showArrowDown) => {
|
|
1772
1807
|
const width = Math.max(theme.arrowUp.length, theme.arrowDown.length);
|
|
@@ -1994,7 +2029,7 @@ const Int = (options) => {
|
|
|
1994
2029
|
* @category combinators
|
|
1995
2030
|
* @since 4.0.0
|
|
1996
2031
|
*/
|
|
1997
|
-
const map$
|
|
2032
|
+
const map$1 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(a))));
|
|
1998
2033
|
/**
|
|
1999
2034
|
* Creates a password prompt that masks typed input and returns the submitted
|
|
2000
2035
|
* value wrapped in `Redacted`.
|
|
@@ -2003,7 +2038,7 @@ const map$2 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(
|
|
|
2003
2038
|
* @category constructors
|
|
2004
2039
|
* @since 4.0.0
|
|
2005
2040
|
*/
|
|
2006
|
-
const Password = (options) => basePrompt(options, "password").pipe(map$
|
|
2041
|
+
const Password = (options) => basePrompt(options, "password").pipe(map$1(make$2));
|
|
2007
2042
|
/**
|
|
2008
2043
|
* Runs a prompt by reading terminal input and rendering prompt frames until the
|
|
2009
2044
|
* prompt submits a value.
|
|
@@ -2019,7 +2054,7 @@ const Password = (options) => basePrompt(options, "password").pipe(map$2(make$2)
|
|
|
2019
2054
|
*/
|
|
2020
2055
|
const run$2 = /*#__PURE__*/ fnUntraced(function* (self) {
|
|
2021
2056
|
const terminal = yield* Terminal;
|
|
2022
|
-
const input = yield* terminal.readInput;
|
|
2057
|
+
const input = yield* cached(terminal.readInput);
|
|
2023
2058
|
return yield* runWithInput(self, terminal, input);
|
|
2024
2059
|
}, /*#__PURE__*/ mapError(() => new QuitError({})), scoped);
|
|
2025
2060
|
const getSelectInitialIndex = (choices) => {
|
|
@@ -2116,7 +2151,7 @@ const proto = {
|
|
|
2116
2151
|
const runWithInput = (prompt, terminal, input) => suspend(() => {
|
|
2117
2152
|
const op = prompt;
|
|
2118
2153
|
switch (op._tag) {
|
|
2119
|
-
case "Loop": return runLoop(op, terminal,
|
|
2154
|
+
case "Loop": return flatMap$1(input, (queue) => runLoop(op, terminal, queue));
|
|
2120
2155
|
case "OnSuccess": return flatMap$1(runWithInput(op.prompt, terminal, input), (a) => runWithInput(op.onSuccess(a), terminal, input));
|
|
2121
2156
|
case "Succeed": return succeed$1(op.value);
|
|
2122
2157
|
}
|
|
@@ -2130,11 +2165,11 @@ const runLoop = /*#__PURE__*/ fnUntraced(function* (loop, terminal, input) {
|
|
|
2130
2165
|
yield* orDie(terminal.display(clear + msg));
|
|
2131
2166
|
clear = "";
|
|
2132
2167
|
if (loop.events) {
|
|
2133
|
-
const takeInput = take(input).pipe(map$
|
|
2168
|
+
const takeInput = take(input).pipe(map$2((input) => ({
|
|
2134
2169
|
_tag: "Input",
|
|
2135
2170
|
input
|
|
2136
2171
|
})));
|
|
2137
|
-
const result = yield* raceFirst(takeInput, take(loop.events).pipe(map$
|
|
2172
|
+
const result = yield* raceFirst(takeInput, take(loop.events).pipe(map$2((value) => ({
|
|
2138
2173
|
_tag: "Event",
|
|
2139
2174
|
value
|
|
2140
2175
|
}))));
|
|
@@ -2171,7 +2206,7 @@ const eraseText = (text, columns) => {
|
|
|
2171
2206
|
};
|
|
2172
2207
|
const lines = (prompt, columns) => {
|
|
2173
2208
|
const lines = prompt.split(NEWLINE_REGEXP);
|
|
2174
|
-
return columns === 0 ? lines.length : pipe(map$
|
|
2209
|
+
return columns === 0 ? lines.length : pipe(map$4(lines, (line) => Math.ceil(line.length / columns)), reduce(0, (left, right) => left + right));
|
|
2175
2210
|
};
|
|
2176
2211
|
const clearOutputWithError = (outputText, columns, errorText) => {
|
|
2177
2212
|
if (errorText !== void 0 && errorText.length > 0) return cursorDown(lines(errorText, columns)) + eraseText(`\n${errorText}`, columns) + eraseText(outputText, columns);
|
|
@@ -2184,26 +2219,25 @@ const handleConfirmClear = (options) => {
|
|
|
2184
2219
|
const columns = yield* (yield* Terminal).columns;
|
|
2185
2220
|
const figures = yield* getTheme(options);
|
|
2186
2221
|
const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;
|
|
2187
|
-
const promptText =
|
|
2222
|
+
const promptText = renderPrompt(confirmMessage, options.message, figures.prefix, figures.pointerSmall, figures, { plain: true });
|
|
2188
2223
|
return eraseText(promptText, columns) + (eraseLine + cursorLeft);
|
|
2189
2224
|
});
|
|
2190
2225
|
};
|
|
2191
|
-
const renderConfirmOutput = (confirm, leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2192
2226
|
const renderConfirmNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2193
2227
|
const figures = yield* getTheme(options);
|
|
2194
|
-
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2195
|
-
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2228
|
+
const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
|
|
2229
|
+
const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
|
|
2196
2230
|
const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;
|
|
2197
|
-
const confirm = annotate(confirmMessage, figures.mutedColor);
|
|
2198
|
-
const promptMsg =
|
|
2231
|
+
const confirm = annotate(figures.colors, confirmMessage, figures.mutedColor);
|
|
2232
|
+
const promptMsg = renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, figures);
|
|
2199
2233
|
return cursorHide + promptMsg;
|
|
2200
2234
|
});
|
|
2201
2235
|
const renderConfirmSubmission = /*#__PURE__*/ fnUntraced(function* (value, options) {
|
|
2202
2236
|
const figures = yield* getTheme(options);
|
|
2203
|
-
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2204
|
-
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2237
|
+
const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
|
|
2238
|
+
const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
|
|
2205
2239
|
const confirmMessage = value ? options.label.confirm : options.label.deny;
|
|
2206
|
-
return
|
|
2240
|
+
return renderPrompt(confirmMessage, options.message, leadingSymbol, trailingSymbol, figures) + "\n";
|
|
2207
2241
|
});
|
|
2208
2242
|
const handleConfirmRender = (options) => {
|
|
2209
2243
|
return (_, action) => {
|
|
@@ -2229,7 +2263,7 @@ const handleDateClear = (options) => {
|
|
|
2229
2263
|
const figures = yield* getTheme(options);
|
|
2230
2264
|
const resetCurrentLine = eraseLine + cursorLeft;
|
|
2231
2265
|
const parts = reduce(state.dateParts, "", (doc, part) => doc + part.toString());
|
|
2232
|
-
const promptText =
|
|
2266
|
+
const promptText = renderPrompt(parts, options.message, figures.prefix, figures.pointerSmall, figures, { plain: true });
|
|
2233
2267
|
const errorText = isSome(state.error) ? match(state.error.value.split(NEWLINE_REGEXP), {
|
|
2234
2268
|
onEmpty: () => "",
|
|
2235
2269
|
onNonEmpty: (errorLines) => separateSymbol(figures.pointerSmall, errorLines.join("\n"))
|
|
@@ -2241,8 +2275,8 @@ const renderDateError = (state, pointer, theme) => {
|
|
|
2241
2275
|
if (isSome(state.error)) {
|
|
2242
2276
|
const errorLines = state.error.value.split(NEWLINE_REGEXP);
|
|
2243
2277
|
if (isReadonlyArrayNonEmpty(errorLines)) {
|
|
2244
|
-
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
2245
|
-
const lines = map$
|
|
2278
|
+
const prefix = annotateSymbol(theme, pointer, theme.errorColor);
|
|
2279
|
+
const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
|
|
2246
2280
|
return cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + cursorRestorePosition;
|
|
2247
2281
|
}
|
|
2248
2282
|
}
|
|
@@ -2253,27 +2287,26 @@ const renderParts = (state, theme, submitted = false) => {
|
|
|
2253
2287
|
const partDoc = part.toString();
|
|
2254
2288
|
if (currentIndex === state.cursor && !submitted) {
|
|
2255
2289
|
const annotation = combine(underlined, theme.primaryColor);
|
|
2256
|
-
return doc + annotate(partDoc, annotation);
|
|
2290
|
+
return doc + annotate(theme.colors, partDoc, annotation);
|
|
2257
2291
|
}
|
|
2258
2292
|
return doc + partDoc;
|
|
2259
2293
|
});
|
|
2260
2294
|
};
|
|
2261
|
-
const renderDateOutput = (leadingSymbol, trailingSymbol, parts, options, renderOptions) => renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2262
2295
|
const renderDateNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2263
2296
|
const figures = yield* getTheme(options);
|
|
2264
|
-
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2265
|
-
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2297
|
+
const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
|
|
2298
|
+
const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
|
|
2266
2299
|
const parts = renderParts(state, figures);
|
|
2267
|
-
const promptMsg =
|
|
2300
|
+
const promptMsg = renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, figures);
|
|
2268
2301
|
const errorMsg = renderDateError(state, figures.pointerSmall, figures);
|
|
2269
2302
|
return cursorHide + promptMsg + errorMsg;
|
|
2270
2303
|
});
|
|
2271
2304
|
const renderDateSubmission = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2272
2305
|
const figures = yield* getTheme(options);
|
|
2273
|
-
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2274
|
-
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2306
|
+
const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
|
|
2307
|
+
const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
|
|
2275
2308
|
const parts = renderParts(state, figures, true);
|
|
2276
|
-
return
|
|
2309
|
+
return renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, figures) + "\n";
|
|
2277
2310
|
});
|
|
2278
2311
|
const processUp = (state) => {
|
|
2279
2312
|
state.dateParts[state.cursor].increment();
|
|
@@ -2643,7 +2676,7 @@ var Meridiem = class extends DatePart {
|
|
|
2643
2676
|
return /A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
|
|
2644
2677
|
}
|
|
2645
2678
|
};
|
|
2646
|
-
const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options) => {
|
|
2679
|
+
const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, theme, options) => {
|
|
2647
2680
|
const prefix = leadingSymbol.length === 0 ? "" : leadingSymbol + " ";
|
|
2648
2681
|
const renderLine = (line) => {
|
|
2649
2682
|
let output = prefix + line;
|
|
@@ -2652,11 +2685,10 @@ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options)
|
|
|
2652
2685
|
else if (trailingSymbol.length > 0) output += " ";
|
|
2653
2686
|
return output;
|
|
2654
2687
|
};
|
|
2655
|
-
const annotate = options?.plain === true ? (line) => line : annotateLine;
|
|
2656
2688
|
return match(message.split(NEWLINE_REGEXP), {
|
|
2657
2689
|
onEmpty: () => renderLine(""),
|
|
2658
2690
|
onNonEmpty: (promptLines) => {
|
|
2659
|
-
const lines = map$
|
|
2691
|
+
const lines = options?.plain === true ? promptLines : map$4(promptLines, (line) => annotate(theme.colors, line, bold));
|
|
2660
2692
|
return renderLine(lines.join("\n"));
|
|
2661
2693
|
}
|
|
2662
2694
|
});
|
|
@@ -2664,7 +2696,7 @@ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options)
|
|
|
2664
2696
|
const renderChoiceDescription = (choice, isActive, theme, renderOptions) => {
|
|
2665
2697
|
if (!choice.disabled && choice.description && isActive) {
|
|
2666
2698
|
const text = theme.descriptionSeparator + choice.description;
|
|
2667
|
-
return renderOptions?.plain === true ? text : annotate(text, theme.mutedColor);
|
|
2699
|
+
return renderOptions?.plain === true ? text : annotate(theme.colors, text, theme.mutedColor);
|
|
2668
2700
|
}
|
|
2669
2701
|
return "";
|
|
2670
2702
|
};
|
|
@@ -2682,15 +2714,15 @@ const renderNumberInput = (state, submitted, theme, renderOptions) => {
|
|
|
2682
2714
|
const value = state.value === "" ? "" : `${state.value}`;
|
|
2683
2715
|
if (submitted || renderOptions?.plain === true) return value;
|
|
2684
2716
|
const annotation = isSome(state.error) ? theme.errorColor : combine(underlined, theme.primaryColor);
|
|
2685
|
-
return annotate(value, annotation);
|
|
2717
|
+
return annotate(theme.colors, value, annotation);
|
|
2686
2718
|
};
|
|
2687
2719
|
const renderNumberError = (state, pointer, theme, renderOptions) => {
|
|
2688
2720
|
if (isSome(state.error)) return match(state.error.value.split(NEWLINE_REGEXP), {
|
|
2689
2721
|
onEmpty: () => "",
|
|
2690
2722
|
onNonEmpty: (errorLines) => {
|
|
2691
2723
|
if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
|
|
2692
|
-
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
2693
|
-
const lines = map$
|
|
2724
|
+
const prefix = annotateSymbol(theme, pointer, theme.errorColor);
|
|
2725
|
+
const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
|
|
2694
2726
|
return cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + cursorRestorePosition;
|
|
2695
2727
|
}
|
|
2696
2728
|
});
|
|
@@ -2698,19 +2730,19 @@ const renderNumberError = (state, pointer, theme, renderOptions) => {
|
|
|
2698
2730
|
};
|
|
2699
2731
|
const renderNumberOutput = (state, leadingSymbol, trailingSymbol, options, theme, renderOptions, submitted = false) => {
|
|
2700
2732
|
const value = renderNumberInput(state, submitted, theme, renderOptions);
|
|
2701
|
-
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2733
|
+
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
|
|
2702
2734
|
};
|
|
2703
2735
|
const renderNumberNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2704
2736
|
const figures = yield* getTheme(options);
|
|
2705
|
-
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2706
|
-
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2737
|
+
const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
|
|
2738
|
+
const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
|
|
2707
2739
|
const errorMsg = renderNumberError(state, figures.pointerSmall, figures);
|
|
2708
2740
|
return renderNumberOutput(state, leadingSymbol, trailingSymbol, options, figures) + errorMsg;
|
|
2709
2741
|
});
|
|
2710
2742
|
const renderNumberSubmission = /*#__PURE__*/ fnUntraced(function* (nextState, options) {
|
|
2711
2743
|
const figures = yield* getTheme(options);
|
|
2712
|
-
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2713
|
-
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2744
|
+
const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
|
|
2745
|
+
const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
|
|
2714
2746
|
return renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, figures, void 0, true) + "\n";
|
|
2715
2747
|
});
|
|
2716
2748
|
const processNumberBackspace = (state) => {
|
|
@@ -2847,22 +2879,22 @@ const handleProcessFloat = (options) => {
|
|
|
2847
2879
|
}
|
|
2848
2880
|
};
|
|
2849
2881
|
};
|
|
2850
|
-
const renderSelectOutput = (leadingSymbol, trailingSymbol, options, renderOptions) => options.message === void 0 ? void 0 : renderPrompt("", options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2882
|
+
const renderSelectOutput = (leadingSymbol, trailingSymbol, options, theme, renderOptions) => options.message === void 0 ? void 0 : renderPrompt("", options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
|
|
2851
2883
|
const withSelectHeader = (header, body) => header === void 0 ? body : header + "\n" + body;
|
|
2852
2884
|
const renderChoicePrefix = (state, choices, toDisplay, currentIndex, figures, renderOptions) => {
|
|
2853
2885
|
const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length);
|
|
2854
2886
|
if (renderOptions?.plain === true) return state === currentIndex ? figures.pointer + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2855
2887
|
if (choices[currentIndex].disabled) {
|
|
2856
2888
|
const annotation = combine(bold, figures.mutedColor);
|
|
2857
|
-
return state === currentIndex ? annotateSymbol(figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2889
|
+
return state === currentIndex ? annotateSymbol(figures, figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2858
2890
|
}
|
|
2859
|
-
return state === currentIndex ? annotateSymbol(figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2891
|
+
return state === currentIndex ? annotateSymbol(figures, figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2860
2892
|
};
|
|
2861
2893
|
const renderChoiceTitle = (choice, isSelected, theme, renderOptions) => {
|
|
2862
2894
|
if (renderOptions?.plain === true) return choice.title;
|
|
2863
2895
|
const title = choice.title;
|
|
2864
|
-
if (isSelected) return choice.disabled ? annotate(title, combine(underlined, theme.mutedColor)) : annotate(title, combine(underlined, theme.primaryColor));
|
|
2865
|
-
return choice.disabled ? annotate(title, combine(strikethrough, theme.mutedColor)) : title;
|
|
2896
|
+
if (isSelected) return choice.disabled ? annotate(theme.colors, title, combine(underlined, theme.mutedColor)) : annotate(theme.colors, title, combine(underlined, theme.primaryColor));
|
|
2897
|
+
return choice.disabled ? annotate(theme.colors, title, combine(strikethrough, theme.mutedColor)) : title;
|
|
2866
2898
|
};
|
|
2867
2899
|
const renderSelectChoices = (state, options, figures, renderOptions) => {
|
|
2868
2900
|
const choices = options.choices;
|
|
@@ -2881,17 +2913,17 @@ const renderSelectChoices = (state, options, figures, renderOptions) => {
|
|
|
2881
2913
|
const renderSelectNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2882
2914
|
const figures = yield* getTheme(options);
|
|
2883
2915
|
const choices = renderSelectChoices(state, options, figures);
|
|
2884
|
-
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2885
|
-
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2886
|
-
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
|
|
2916
|
+
const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
|
|
2917
|
+
const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
|
|
2918
|
+
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options, figures);
|
|
2887
2919
|
return cursorHide + withSelectHeader(promptMsg, choices);
|
|
2888
2920
|
});
|
|
2889
2921
|
const renderSelectSubmission = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2890
2922
|
const figures = yield* getTheme(options);
|
|
2891
2923
|
const selected = options.choices[state].title;
|
|
2892
|
-
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2893
|
-
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2894
|
-
return (renderSelectOutput(leadingSymbol, trailingSymbol, options) ?? leadingSymbol) + " " + annotate(selected, figures.submittedColor) + "\n";
|
|
2924
|
+
const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
|
|
2925
|
+
const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
|
|
2926
|
+
return (renderSelectOutput(leadingSymbol, trailingSymbol, options, figures) ?? leadingSymbol) + " " + annotate(figures.colors, selected, figures.submittedColor) + "\n";
|
|
2895
2927
|
});
|
|
2896
2928
|
const processSelectCursorUp = (state, choices) => {
|
|
2897
2929
|
if (state === 0) return succeed$1(Action$1.NextFrame({ state: choices.length - 1 }));
|
|
@@ -2917,7 +2949,7 @@ const handleSelectClear = (options) => fnUntraced(function* (state, _) {
|
|
|
2917
2949
|
const columns = yield* (yield* Terminal).columns;
|
|
2918
2950
|
const figures = yield* getTheme(options);
|
|
2919
2951
|
const clearPrompt = eraseLine + cursorLeft;
|
|
2920
|
-
const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, { plain: true });
|
|
2952
|
+
const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, figures, { plain: true });
|
|
2921
2953
|
const choicesText = renderSelectChoices(state, options, figures, { plain: true });
|
|
2922
2954
|
return eraseText(withSelectHeader(promptText, choicesText), columns) + clearPrompt;
|
|
2923
2955
|
});
|
|
@@ -2957,8 +2989,8 @@ const renderTextInput = (nextState, options, theme, submitted, renderOptions) =>
|
|
|
2957
2989
|
const annotation = isSome(nextState.error) ? theme.errorColor : submitted ? theme.submittedColor : combine(underlined, theme.primaryColor);
|
|
2958
2990
|
switch (options.type) {
|
|
2959
2991
|
case "hidden": return "";
|
|
2960
|
-
case "password": return annotateSymbol(theme.passwordMask.repeat(text.length), annotation);
|
|
2961
|
-
case "text": return annotate(text, annotation);
|
|
2992
|
+
case "password": return annotateSymbol(theme, theme.passwordMask.repeat(text.length), annotation);
|
|
2993
|
+
case "text": return annotate(theme.colors, text, annotation);
|
|
2962
2994
|
}
|
|
2963
2995
|
};
|
|
2964
2996
|
const renderTextError = (nextState, pointer, theme, renderOptions) => {
|
|
@@ -2966,8 +2998,8 @@ const renderTextError = (nextState, pointer, theme, renderOptions) => {
|
|
|
2966
2998
|
onEmpty: () => "",
|
|
2967
2999
|
onNonEmpty: (errorLines) => {
|
|
2968
3000
|
if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
|
|
2969
|
-
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
2970
|
-
const lines = map$
|
|
3001
|
+
const prefix = annotateSymbol(theme, pointer, theme.errorColor);
|
|
3002
|
+
const lines = map$4(errorLines, (str) => annotateErrorLine(theme, str));
|
|
2971
3003
|
return cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + cursorRestorePosition;
|
|
2972
3004
|
}
|
|
2973
3005
|
});
|
|
@@ -2975,12 +3007,12 @@ const renderTextError = (nextState, pointer, theme, renderOptions) => {
|
|
|
2975
3007
|
};
|
|
2976
3008
|
const renderTextOutput = (nextState, leadingSymbol, trailingSymbol, options, theme, renderOptions, submitted = false) => {
|
|
2977
3009
|
const value = renderTextInput(nextState, options, theme, submitted, renderOptions);
|
|
2978
|
-
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
3010
|
+
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
|
|
2979
3011
|
};
|
|
2980
3012
|
const renderTextNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2981
3013
|
const figures = yield* getTheme(options);
|
|
2982
|
-
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2983
|
-
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
3014
|
+
const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
|
|
3015
|
+
const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
|
|
2984
3016
|
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures);
|
|
2985
3017
|
const errorMsg = renderTextError(state, figures.pointerSmall, figures);
|
|
2986
3018
|
const cursorWidth = options.type === "password" ? figures.passwordMask.length : 1;
|
|
@@ -2989,8 +3021,8 @@ const renderTextNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options)
|
|
|
2989
3021
|
});
|
|
2990
3022
|
const renderTextSubmission = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
2991
3023
|
const figures = yield* getTheme(options);
|
|
2992
|
-
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2993
|
-
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
3024
|
+
const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
|
|
3025
|
+
const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
|
|
2994
3026
|
return renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures, void 0, true) + "\n";
|
|
2995
3027
|
});
|
|
2996
3028
|
const processTextBackspace = (state) => {
|
|
@@ -3128,32 +3160,29 @@ const handleToggleClear = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
3128
3160
|
const figures = yield* getTheme(options);
|
|
3129
3161
|
const clearPrompt = eraseLine + cursorLeft;
|
|
3130
3162
|
const toggleText = options.active + " " + separateSymbol(figures.toggleSeparator, options.inactive);
|
|
3131
|
-
const promptText = renderPrompt(toggleText, options.message, figures.prefix, figures.pointerSmall, { plain: true });
|
|
3163
|
+
const promptText = renderPrompt(toggleText, options.message, figures.prefix, figures.pointerSmall, figures, { plain: true });
|
|
3132
3164
|
return eraseText(promptText, columns) + clearPrompt;
|
|
3133
3165
|
});
|
|
3134
3166
|
const renderToggle = (value, options, theme, submitted = false) => {
|
|
3135
|
-
const separator = annotateSymbol(theme.toggleSeparator, theme.mutedColor);
|
|
3167
|
+
const separator = annotateSymbol(theme, theme.toggleSeparator, theme.mutedColor);
|
|
3136
3168
|
const selectedAnnotation = combine(underlined, submitted ? theme.submittedColor : theme.primaryColor);
|
|
3137
|
-
const inactive = value ? options.inactive : annotate(options.inactive, selectedAnnotation);
|
|
3138
|
-
return (value ? annotate(options.active, selectedAnnotation) : options.active) + " " + separateSymbol(separator, inactive);
|
|
3139
|
-
};
|
|
3140
|
-
const renderToggleOutput = (toggle, leadingSymbol, trailingSymbol, options) => {
|
|
3141
|
-
return renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol);
|
|
3169
|
+
const inactive = value ? options.inactive : annotate(theme.colors, options.inactive, selectedAnnotation);
|
|
3170
|
+
return (value ? annotate(theme.colors, options.active, selectedAnnotation) : options.active) + " " + separateSymbol(separator, inactive);
|
|
3142
3171
|
};
|
|
3143
3172
|
const renderToggleNextFrame = /*#__PURE__*/ fnUntraced(function* (state, options) {
|
|
3144
3173
|
const figures = yield* getTheme(options);
|
|
3145
|
-
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
3146
|
-
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
3174
|
+
const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
|
|
3175
|
+
const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
|
|
3147
3176
|
const toggle = renderToggle(state, options, figures);
|
|
3148
|
-
const promptMsg =
|
|
3177
|
+
const promptMsg = renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol, figures);
|
|
3149
3178
|
return cursorHide + promptMsg;
|
|
3150
3179
|
});
|
|
3151
3180
|
const renderToggleSubmission = /*#__PURE__*/ fnUntraced(function* (value, options) {
|
|
3152
3181
|
const figures = yield* getTheme(options);
|
|
3153
|
-
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
3154
|
-
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
3182
|
+
const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
|
|
3183
|
+
const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
|
|
3155
3184
|
const toggle = renderToggle(value, options, figures, true);
|
|
3156
|
-
return
|
|
3185
|
+
return renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol, figures) + "\n";
|
|
3157
3186
|
});
|
|
3158
3187
|
const activate = /*#__PURE__*/ succeed$1(/*#__PURE__*/ Action$1.NextFrame({ state: true }));
|
|
3159
3188
|
const deactivate = /*#__PURE__*/ succeed$1(/*#__PURE__*/ Action$1.NextFrame({ state: false }));
|
|
@@ -3195,7 +3224,7 @@ const entriesToDisplay = (cursor, total, maxVisible) => {
|
|
|
3195
3224
|
};
|
|
3196
3225
|
};
|
|
3197
3226
|
//#endregion
|
|
3198
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
3227
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Param.js
|
|
3199
3228
|
/**
|
|
3200
3229
|
* Defines the shared parameter model for CLI arguments and flags.
|
|
3201
3230
|
*
|
|
@@ -3386,32 +3415,6 @@ const ChoiceWithValue$1 = (kind, name, choices) => makeSingle({
|
|
|
3386
3415
|
primitiveType: Choice(choices),
|
|
3387
3416
|
kind
|
|
3388
3417
|
});
|
|
3389
|
-
/**
|
|
3390
|
-
* Constructs command-line params that represent a choice between several
|
|
3391
|
-
* string inputs.
|
|
3392
|
-
*
|
|
3393
|
-
* **Example** (Creating string choices)
|
|
3394
|
-
*
|
|
3395
|
-
* ```ts import.meta.vitest
|
|
3396
|
-
* import { Param } from "effect/cli"
|
|
3397
|
-
*
|
|
3398
|
-
* const logLevel = Param.Literals(Param.flagKind, "log-level", [
|
|
3399
|
-
* "debug",
|
|
3400
|
-
* "info",
|
|
3401
|
-
* "warn",
|
|
3402
|
-
* "error"
|
|
3403
|
-
* ])
|
|
3404
|
-
* logLevel.kind // => "flag"
|
|
3405
|
-
* ```
|
|
3406
|
-
*
|
|
3407
|
-
* @stability unstable
|
|
3408
|
-
* @category constructors
|
|
3409
|
-
* @since 4.0.0
|
|
3410
|
-
*/
|
|
3411
|
-
const Literals$1 = (kind, name, choices) => {
|
|
3412
|
-
const mappedChoices = choices.map((value) => [value, value]);
|
|
3413
|
-
return ChoiceWithValue$1(kind, name, mappedChoices);
|
|
3414
|
-
};
|
|
3415
3418
|
const FLAG_DASH_REGEXP = /^-+/;
|
|
3416
3419
|
/**
|
|
3417
3420
|
* Adds an alias to an option.
|
|
@@ -3502,8 +3505,8 @@ const withDescription$3 = /*#__PURE__*/ dual(2, (self, description) => {
|
|
|
3502
3505
|
* @category combinators
|
|
3503
3506
|
* @since 4.0.0
|
|
3504
3507
|
*/
|
|
3505
|
-
const map
|
|
3506
|
-
const parse = (args) => map$
|
|
3508
|
+
const map = /*#__PURE__*/ dual(2, (self, f) => {
|
|
3509
|
+
const parse = (args) => map$2(self.parse(args), ([operands, value]) => [operands, f(value)]);
|
|
3507
3510
|
return Object.assign(Object.create(Proto$1), {
|
|
3508
3511
|
_tag: "Map",
|
|
3509
3512
|
kind: self.kind,
|
|
@@ -3578,7 +3581,7 @@ const transform = (self, f, alternatives = []) => {
|
|
|
3578
3581
|
* @category combinators
|
|
3579
3582
|
* @since 4.0.0
|
|
3580
3583
|
*/
|
|
3581
|
-
const mapEffect = /*#__PURE__*/ dual(2, (self, f) => transform(self, (parse) => (args) => flatMap$1(parse(args), ([leftover, a]) => f(a).pipe(map$
|
|
3584
|
+
const mapEffect = /*#__PURE__*/ dual(2, (self, f) => transform(self, (parse) => (args) => flatMap$1(parse(args), ([leftover, a]) => f(a).pipe(map$2((b) => [leftover, b])))));
|
|
3582
3585
|
/**
|
|
3583
3586
|
* Makes a flag or positional argument optional.
|
|
3584
3587
|
*
|
|
@@ -3605,7 +3608,7 @@ const mapEffect = /*#__PURE__*/ dual(2, (self, f) => transform(self, (parse) =>
|
|
|
3605
3608
|
* @since 4.0.0
|
|
3606
3609
|
*/
|
|
3607
3610
|
const optional$1 = (param) => {
|
|
3608
|
-
const parse = (args) => param.parse(args).pipe(map$
|
|
3611
|
+
const parse = (args) => param.parse(args).pipe(map$2(([leftover, value]) => [leftover, some(value)]), catchTags({
|
|
3609
3612
|
MissingOption: () => succeed$1([args.arguments, none()]),
|
|
3610
3613
|
MissingArgument: () => succeed$1([args.arguments, none()])
|
|
3611
3614
|
}));
|
|
@@ -3648,7 +3651,7 @@ const optional$1 = (param) => {
|
|
|
3648
3651
|
* @since 4.0.0
|
|
3649
3652
|
*/
|
|
3650
3653
|
const withDefault$1 = /*#__PURE__*/ dual(2, (self, defaultValue) => {
|
|
3651
|
-
if (!isEffect(defaultValue)) return map
|
|
3654
|
+
if (!isEffect(defaultValue)) return map(optional$1(self), getOrElse(() => defaultValue));
|
|
3652
3655
|
return mapEffect(optional$1(self), match$1({
|
|
3653
3656
|
onNone: () => defaultValue,
|
|
3654
3657
|
onSome: succeed$1
|
|
@@ -3866,7 +3869,7 @@ const matchParam = (param, patterns) => {
|
|
|
3866
3869
|
const transformSingle = (param, f) => {
|
|
3867
3870
|
return matchParam(param, {
|
|
3868
3871
|
Single: (single) => f(single),
|
|
3869
|
-
Map: (mapped) => map
|
|
3872
|
+
Map: (mapped) => map(transformSingle(mapped.param, f), mapped.f),
|
|
3870
3873
|
Transform: (mapped) => transform(transformSingle(mapped.param, f), mapped.f, mapped.alternatives.map((alternative) => () => transformSingle(alternative(), f))),
|
|
3871
3874
|
Optional: (p) => optional$1(transformSingle(p.param, f)),
|
|
3872
3875
|
Variadic: (p) => variadic(transformSingle(p.param, f), {
|
|
@@ -3930,7 +3933,7 @@ const getParamMetadata = (param) => {
|
|
|
3930
3933
|
});
|
|
3931
3934
|
};
|
|
3932
3935
|
//#endregion
|
|
3933
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
3936
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Argument.js
|
|
3934
3937
|
/**
|
|
3935
3938
|
* Creates a positional string argument.
|
|
3936
3939
|
*
|
|
@@ -3968,7 +3971,7 @@ const String$2 = (name) => String$3(argumentKind, name);
|
|
|
3968
3971
|
*/
|
|
3969
3972
|
const withDescription$2 = /*#__PURE__*/ dual(2, (self, description) => withDescription$3(self, description));
|
|
3970
3973
|
//#endregion
|
|
3971
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
3974
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/CliOutput.js
|
|
3972
3975
|
/**
|
|
3973
3976
|
* Formats CLI help and errors as text.
|
|
3974
3977
|
*
|
|
@@ -4045,9 +4048,7 @@ const escapeControlCharacters = (text) => text.replace(/[\u0000-\u0008\u000B\u00
|
|
|
4045
4048
|
* @since 4.0.0
|
|
4046
4049
|
*/
|
|
4047
4050
|
const defaultFormatter = (options) => {
|
|
4048
|
-
const
|
|
4049
|
-
const hasProcess = typeof globalProcess === "object" && globalProcess !== null;
|
|
4050
|
-
const useColor = options?.colors !== void 0 ? options.colors : hasProcess && typeof globalProcess.stdout === "object" && globalProcess.stdout !== null && globalProcess.stdout.isTTY === true && !globalProcess.env?.NO_COLOR;
|
|
4051
|
+
const useColor = options?.colors ?? detectColors();
|
|
4051
4052
|
const colors = useColor ? {
|
|
4052
4053
|
bold: (text) => `\x1b[1m${text}\x1b[0m`,
|
|
4053
4054
|
dim: (text) => `\x1b[2m${text}\x1b[0m`,
|
|
@@ -4100,7 +4101,7 @@ const stripAnsi = (text) => {
|
|
|
4100
4101
|
return text.replace(/\u001B\[[0-9;]*m/g, "");
|
|
4101
4102
|
};
|
|
4102
4103
|
/**
|
|
4103
|
-
*
|
|
4104
|
+
* Segments text into grapheme clusters.
|
|
4104
4105
|
* @internal
|
|
4105
4106
|
*/
|
|
4106
4107
|
const graphemeSegmenter = /*#__PURE__*/ new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
@@ -4116,7 +4117,33 @@ const graphemeWidth = (grapheme) => {
|
|
|
4116
4117
|
if (emojiPresentation.test(grapheme) || grapheme.includes("️")) return 2;
|
|
4117
4118
|
return isFullWidthCodePoint(visible.codePointAt(0)) ? 2 : 1;
|
|
4118
4119
|
};
|
|
4119
|
-
|
|
4120
|
+
/**
|
|
4121
|
+
* Measures the number of terminal cells a string occupies.
|
|
4122
|
+
*
|
|
4123
|
+
* **Details**
|
|
4124
|
+
*
|
|
4125
|
+
* Uses the same measurement as built-in help and table rendering. ANSI styling
|
|
4126
|
+
* is stripped before measuring graphemes: zero-width graphemes count as `0`,
|
|
4127
|
+
* emoji presentation sequences and fullwidth characters as `2`, and other
|
|
4128
|
+
* graphemes as `1`.
|
|
4129
|
+
*
|
|
4130
|
+
* **Example** (Measuring terminal-cell widths)
|
|
4131
|
+
*
|
|
4132
|
+
* ```ts import.meta.vitest
|
|
4133
|
+
* import { CliOutput } from "effect/cli"
|
|
4134
|
+
*
|
|
4135
|
+
* CliOutput.displayWidth("file") // => 4
|
|
4136
|
+
* CliOutput.displayWidth("ファイル") // => 8
|
|
4137
|
+
* CliOutput.displayWidth("é") // => 1
|
|
4138
|
+
* CliOutput.displayWidth("1️⃣") // => 2
|
|
4139
|
+
* CliOutput.displayWidth("\u001B[1mbold\u001B[0m") // => 4
|
|
4140
|
+
* ```
|
|
4141
|
+
*
|
|
4142
|
+
* @stability unstable
|
|
4143
|
+
* @category measuring
|
|
4144
|
+
* @since 4.0.3
|
|
4145
|
+
*/
|
|
4146
|
+
const displayWidth = (text) => {
|
|
4120
4147
|
let length = 0;
|
|
4121
4148
|
for (const { segment } of graphemeSegmenter.segment(stripAnsi(text))) length += graphemeWidth(segment);
|
|
4122
4149
|
return length;
|
|
@@ -4126,7 +4153,7 @@ const visualLength = (text) => {
|
|
|
4126
4153
|
* @internal
|
|
4127
4154
|
*/
|
|
4128
4155
|
const pad = (s, width) => {
|
|
4129
|
-
const actualLength =
|
|
4156
|
+
const actualLength = displayWidth(s);
|
|
4130
4157
|
const padding = Math.max(0, width - actualLength);
|
|
4131
4158
|
return s + " ".repeat(padding);
|
|
4132
4159
|
};
|
|
@@ -4135,9 +4162,9 @@ const pad = (s, width) => {
|
|
|
4135
4162
|
* @internal
|
|
4136
4163
|
*/
|
|
4137
4164
|
const renderTable = (rows, widthCap) => {
|
|
4138
|
-
const maxColumn = Math.max(...rows.map((r) =>
|
|
4165
|
+
const maxColumn = Math.max(...rows.map((r) => displayWidth(r.left))) + 4;
|
|
4139
4166
|
const col = widthCap === void 0 ? maxColumn : Math.min(maxColumn, widthCap);
|
|
4140
|
-
return rows.map(({ left, right }) => ` ${pad(left, Math.max(col,
|
|
4167
|
+
return rows.map(({ left, right }) => ` ${pad(left, Math.max(col, displayWidth(left) + 1))}${right}`).join("\n");
|
|
4141
4168
|
};
|
|
4142
4169
|
const formatSubcommandName = (name, alias) => alias ? `${name}, ${alias}` : name;
|
|
4143
4170
|
/**
|
|
@@ -4236,7 +4263,7 @@ const formatHelpDocImpl = (doc, colors) => {
|
|
|
4236
4263
|
return sections.join("\n");
|
|
4237
4264
|
};
|
|
4238
4265
|
//#endregion
|
|
4239
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4266
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/bash.js
|
|
4240
4267
|
const escapeForBash = (s) => s.replace(/'/g, "'\\''");
|
|
4241
4268
|
const sanitizeFunctionName = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
4242
4269
|
const flagNamesForWordlist = (flag) => {
|
|
@@ -4461,7 +4488,7 @@ const generateFunction$1 = (descriptor, parentPath, lines, helperName) => {
|
|
|
4461
4488
|
/**
|
|
4462
4489
|
* @internal
|
|
4463
4490
|
*/
|
|
4464
|
-
const generate$
|
|
4491
|
+
const generate$4 = (executableName, descriptor) => {
|
|
4465
4492
|
const lines = [];
|
|
4466
4493
|
const safeName = sanitizeFunctionName(executableName);
|
|
4467
4494
|
const helperName = `_${safeName}--choices`;
|
|
@@ -4506,7 +4533,7 @@ const generate$3 = (executableName, descriptor) => {
|
|
|
4506
4533
|
return lines.join("\n");
|
|
4507
4534
|
};
|
|
4508
4535
|
//#endregion
|
|
4509
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4536
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/fish.js
|
|
4510
4537
|
const escapeFishString = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
4511
4538
|
/** Escape choices for Fish's second expansion of `complete -a`. */
|
|
4512
4539
|
const escapeFishChoice = (s) => escapeFishString(s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&"));
|
|
@@ -4640,7 +4667,7 @@ const generateCompletions = (executableName, descriptor, parentPath, lines) => {
|
|
|
4640
4667
|
/**
|
|
4641
4668
|
* @internal
|
|
4642
4669
|
*/
|
|
4643
|
-
const generate$
|
|
4670
|
+
const generate$3 = (executableName, descriptor) => {
|
|
4644
4671
|
const lines = [];
|
|
4645
4672
|
lines.push(`###-begin-${executableName}-completions-###`);
|
|
4646
4673
|
lines.push(`#`);
|
|
@@ -4656,8 +4683,277 @@ const generate$2 = (executableName, descriptor) => {
|
|
|
4656
4683
|
return lines.join("\n");
|
|
4657
4684
|
};
|
|
4658
4685
|
//#endregion
|
|
4659
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4686
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/powershell.js
|
|
4687
|
+
/**
|
|
4688
|
+
* Encode non-ASCII and control characters as `[char]` code units. Windows
|
|
4689
|
+
* PowerShell 5.1 can misread BOM-less UTF-8 as ANSI, turning some bytes into
|
|
4690
|
+
* PowerShell quote delimiters.
|
|
4691
|
+
*/
|
|
4692
|
+
const quotePs = (s) => {
|
|
4693
|
+
const parts = [];
|
|
4694
|
+
let literal = "";
|
|
4695
|
+
for (let i = 0; i < s.length; i++) {
|
|
4696
|
+
const code = s.charCodeAt(i);
|
|
4697
|
+
if (code >= 32 && code < 128) {
|
|
4698
|
+
literal += s[i] === "'" ? "''" : s[i];
|
|
4699
|
+
continue;
|
|
4700
|
+
}
|
|
4701
|
+
if (literal !== "" || parts.length === 0) parts.push(`'${literal}'`);
|
|
4702
|
+
literal = "";
|
|
4703
|
+
parts.push(`[char]0x${code.toString(16).toUpperCase().padStart(4, "0")}`);
|
|
4704
|
+
}
|
|
4705
|
+
if (literal !== "" || parts.length === 0) parts.push(`'${literal}'`);
|
|
4706
|
+
return parts.length === 1 ? parts[0] : `(${parts.join(" + ")})`;
|
|
4707
|
+
};
|
|
4708
|
+
const psArray = (items) => `@(${items.map(quotePs).join(", ")})`;
|
|
4709
|
+
const psOptional = (s) => s ? quotePs(s) : "$null";
|
|
4710
|
+
const sanitize$1 = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
4711
|
+
const flagForms = (flag) => [`--${flag.name}`, ...flag.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`)];
|
|
4712
|
+
const valueFields = (type) => `values = ${psArray(type._tag === "Choice" ? type.values : [])}; pathType = ${type._tag === "Path" ? quotePs(type.pathType) : "$null"}`;
|
|
4713
|
+
const flagEntry = (flag) => `@{ name = ${quotePs(flag.name)}; forms = ${psArray(flagForms(flag))}; takesValue = $${flag.type._tag !== "Boolean"}; ${valueFields(flag.type)}; description = ${psOptional(flag.description)} }`;
|
|
4714
|
+
const argumentEntry = (argument) => `@{ name = ${quotePs(argument.name)}; variadic = $${argument.variadic}; ${valueFields(argument.type)}; description = ${psOptional(argument.description)} }`;
|
|
4715
|
+
const pushList = (lines, field, entries) => {
|
|
4716
|
+
if (entries.length === 0) {
|
|
4717
|
+
lines.push(` ${field} = @()`);
|
|
4718
|
+
return;
|
|
4719
|
+
}
|
|
4720
|
+
lines.push(` ${field} = @(`);
|
|
4721
|
+
for (const entry of entries) lines.push(` ${entry}`);
|
|
4722
|
+
lines.push(` )`);
|
|
4723
|
+
};
|
|
4724
|
+
/**
|
|
4725
|
+
* Emit one context per subcommand path. Subcommands are case-sensitive, so
|
|
4726
|
+
* contexts go in an ordinal hashtable instead of a hash literal, whose keys
|
|
4727
|
+
* ignore case.
|
|
4728
|
+
*/
|
|
4729
|
+
const generateContexts = (dataName, descriptor, path, lines, seen) => {
|
|
4730
|
+
const key = path.join(" ");
|
|
4731
|
+
if (seen.has(key)) return;
|
|
4732
|
+
seen.add(key);
|
|
4733
|
+
lines.push(`${dataName}[${quotePs(key)}] = @{`);
|
|
4734
|
+
pushList(lines, "subcommands", descriptor.subcommands.map((sub) => `@{ name = ${quotePs(sub.name)}; description = ${psOptional(sub.description)} }`));
|
|
4735
|
+
pushList(lines, "flags", descriptor.flags.map(flagEntry));
|
|
4736
|
+
pushList(lines, "arguments", descriptor.arguments.map(argumentEntry));
|
|
4737
|
+
lines.push(`}`);
|
|
4738
|
+
for (const sub of descriptor.subcommands) generateContexts(dataName, sub, [...path, sub.name], lines, seen);
|
|
4739
|
+
};
|
|
4740
|
+
/**
|
|
4741
|
+
* Replay the committed words with the CLI lexer and parser rules: `--`, short
|
|
4742
|
+
* flag clusters, inline values, boolean literals, negative numbers, and
|
|
4743
|
+
* subcommand selection by the first value only.
|
|
4744
|
+
*/
|
|
4745
|
+
const completer = (dataName) => String.raw` param($wordToComplete, $commandAst, $cursorPosition)
|
|
4746
|
+
|
|
4747
|
+
$spec = ${dataName}
|
|
4748
|
+
$results = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
|
|
4749
|
+
$booleanLiterals = @('true', 'yes', 'on', '1', 'y', 'false', 'no', 'off', '0', 'n')
|
|
4750
|
+
|
|
4751
|
+
$index = {
|
|
4752
|
+
param($context)
|
|
4753
|
+
$lookup = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
4754
|
+
foreach ($flag in $context.flags) {
|
|
4755
|
+
foreach ($form in $flag.forms) { $lookup[$form] = $flag }
|
|
4756
|
+
}
|
|
4757
|
+
$lookup
|
|
4758
|
+
}
|
|
4759
|
+
|
|
4760
|
+
$add = {
|
|
4761
|
+
param([string]$value, [string]$type, $tooltip, [string]$typed, [string]$textPrefix)
|
|
4762
|
+
if (-not $value.StartsWith($typed, [System.StringComparison]::OrdinalIgnoreCase)) { return }
|
|
4763
|
+
$text = $value
|
|
4764
|
+
if ($value -notmatch '^[\w./:%+=\\-]+$') { $text = "'" + ($value -replace "['\u2018-\u201b]", '$0$0') + "'" }
|
|
4765
|
+
$text = $textPrefix + $text
|
|
4766
|
+
$label = $value
|
|
4767
|
+
if (-not $label) { $label = $text }
|
|
4768
|
+
if (-not $tooltip) { $tooltip = $label }
|
|
4769
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($text, $label, $type, $tooltip))
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
$addValues = {
|
|
4773
|
+
param($entry, [string]$typed, [string]$textPrefix)
|
|
4774
|
+
foreach ($value in $entry.values) {
|
|
4775
|
+
if ($textPrefix -eq '' -and (& $optionLike $value)) { continue }
|
|
4776
|
+
& $add $value 'ParameterValue' $entry.description $typed $textPrefix
|
|
4777
|
+
}
|
|
4778
|
+
if ($entry.pathType) {
|
|
4779
|
+
foreach ($file in [System.Management.Automation.CompletionCompleters]::CompleteFilename($typed)) {
|
|
4780
|
+
if ($entry.pathType -eq 'directory' -and $file.ResultType -ne 'ProviderContainer') { continue }
|
|
4781
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($textPrefix + $file.CompletionText, $file.ListItemText, $file.ResultType, $file.ToolTip))
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4786
|
+
$addFlags = {
|
|
4787
|
+
param([string]$typed)
|
|
4788
|
+
foreach ($flag in $context.flags) {
|
|
4789
|
+
if ($used.ContainsKey($flag.name)) { continue }
|
|
4790
|
+
foreach ($form in $flag.forms) {
|
|
4791
|
+
& $add $form 'ParameterName' $flag.description $typed ''
|
|
4792
|
+
}
|
|
4793
|
+
if (-not $flag.takesValue) {
|
|
4794
|
+
$tooltip = $null
|
|
4795
|
+
if ($flag.description) { $tooltip = 'Disable ' + $flag.name }
|
|
4796
|
+
& $add ('--no-' + $flag.name) 'ParameterName' $tooltip $typed ''
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
|
|
4801
|
+
# As in the CLI lexer, nothing after '--' is an option, and negative numbers
|
|
4802
|
+
# and a lone '-' are values.
|
|
4803
|
+
$optionLike = {
|
|
4804
|
+
param([string]$word)
|
|
4805
|
+
-not $endOfOptions -and $word -match '^-.' -and $word -notmatch '^-(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$'
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
# A typed value that has no candidates completes to itself, so the engine
|
|
4809
|
+
# does not fall back to listing files.
|
|
4810
|
+
$keepTyped = {
|
|
4811
|
+
if ($results.Count -eq 0 -and $current) {
|
|
4812
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($current, $current, 'ParameterValue', $current))
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
|
|
4816
|
+
$path = ''
|
|
4817
|
+
$context = $spec[$path]
|
|
4818
|
+
$lookup = & $index $context
|
|
4819
|
+
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
4820
|
+
$pending = $null
|
|
4821
|
+
$endOfOptions = $false
|
|
4822
|
+
$position = 0
|
|
4823
|
+
|
|
4824
|
+
# The engine strips the quotes from a quoted word.
|
|
4825
|
+
$typed = [string]$wordToComplete
|
|
4826
|
+
if ($typed -match '^([''"])(.*?)\1?$') { $typed = $Matches[2] }
|
|
4827
|
+
$current = $null
|
|
4828
|
+
|
|
4829
|
+
$elements = $commandAst.CommandElements
|
|
4830
|
+
for ($i = 1; $i -lt $elements.Count; $i++) {
|
|
4831
|
+
$element = $elements[$i]
|
|
4832
|
+
$word = $element.Extent.Text
|
|
4833
|
+
if ($element -is [System.Management.Automation.Language.StringConstantExpressionAst]) { $word = $element.Value }
|
|
4834
|
+
if ($element.Extent.EndOffset -ge $cursorPosition) {
|
|
4835
|
+
if ($element -is [System.Management.Automation.Language.ConstantExpressionAst] -and $element.Extent.StartOffset -le $cursorPosition) {
|
|
4836
|
+
$current = $element.Extent.Text
|
|
4837
|
+
if ($element.Extent.EndOffset -eq $cursorPosition) { $typed = $word }
|
|
4838
|
+
}
|
|
4839
|
+
break
|
|
4840
|
+
}
|
|
4841
|
+
|
|
4842
|
+
# A flag takes the next word as its value unless it is an option or '--';
|
|
4843
|
+
# a boolean flag only takes a boolean literal.
|
|
4844
|
+
$isOption = & $optionLike $word
|
|
4845
|
+
if ($null -ne $pending) {
|
|
4846
|
+
$flag = $pending
|
|
4847
|
+
$pending = $null
|
|
4848
|
+
if ($flag.takesValue) {
|
|
4849
|
+
if (-not $isOption) { continue }
|
|
4850
|
+
} elseif ($booleanLiterals -ccontains $word) { continue }
|
|
4851
|
+
}
|
|
4852
|
+
if ($endOfOptions) { $position++; continue }
|
|
4853
|
+
if ($word -ceq '--') { $endOfOptions = $true; continue }
|
|
4854
|
+
|
|
4855
|
+
if ($isOption) {
|
|
4856
|
+
$hasValue = $word.Contains('=')
|
|
4857
|
+
if ($hasValue) {
|
|
4858
|
+
$forms = @($word.Substring(0, $word.IndexOf('=')))
|
|
4859
|
+
} elseif ($word.StartsWith('--')) {
|
|
4860
|
+
$forms = @($word)
|
|
4861
|
+
} else {
|
|
4862
|
+
$forms = @(foreach ($char in $word.Substring(1).ToCharArray()) { '-' + $char })
|
|
4863
|
+
}
|
|
4864
|
+
foreach ($form in $forms) {
|
|
4865
|
+
$pending = $null
|
|
4866
|
+
$flag = $lookup[$form]
|
|
4867
|
+
if ($null -eq $flag) {
|
|
4868
|
+
if ($form.StartsWith('--no-')) {
|
|
4869
|
+
$name = $form.Substring(5)
|
|
4870
|
+
$flag = $lookup['--' + $name]
|
|
4871
|
+
if ($null -ne $flag -and -not $flag.takesValue -and $flag.name -ceq $name) { $used[$name] = $true }
|
|
4872
|
+
}
|
|
4873
|
+
continue
|
|
4874
|
+
}
|
|
4875
|
+
$used[$flag.name] = $true
|
|
4876
|
+
if (-not $hasValue) { $pending = $flag }
|
|
4877
|
+
}
|
|
4878
|
+
continue
|
|
4879
|
+
}
|
|
4880
|
+
|
|
4881
|
+
if ($position -eq 0 -and $context.subcommands.name -ccontains $word) {
|
|
4882
|
+
if ($path) { $path = $path + ' ' + $word } else { $path = $word }
|
|
4883
|
+
$context = $spec[$path]
|
|
4884
|
+
$lookup = & $index $context
|
|
4885
|
+
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
4886
|
+
continue
|
|
4887
|
+
}
|
|
4888
|
+
$position++
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
$typedIsOption = & $optionLike $typed
|
|
4892
|
+
if ($null -ne $pending -and $pending.takesValue -and -not $typedIsOption) {
|
|
4893
|
+
& $addValues $pending $typed ''
|
|
4894
|
+
& $keepTyped
|
|
4895
|
+
return $results
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4898
|
+
if ($typedIsOption) {
|
|
4899
|
+
if ($typed -match '^(-[^=]+)=(.*)$') {
|
|
4900
|
+
$form = $Matches[1]
|
|
4901
|
+
$flag = $lookup[$form]
|
|
4902
|
+
if ($null -ne $flag -and $flag.takesValue) {
|
|
4903
|
+
& $addValues $flag $Matches[2] ($form + '=')
|
|
4904
|
+
& $keepTyped
|
|
4905
|
+
}
|
|
4906
|
+
} else {
|
|
4907
|
+
& $addFlags $typed
|
|
4908
|
+
}
|
|
4909
|
+
return $results
|
|
4910
|
+
}
|
|
4911
|
+
|
|
4912
|
+
if (-not $endOfOptions -and $position -eq 0) {
|
|
4913
|
+
foreach ($sub in $context.subcommands) {
|
|
4914
|
+
& $add $sub.name 'Command' $sub.description $typed ''
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
|
|
4918
|
+
$arguments = $context.arguments
|
|
4919
|
+
if ($position -lt $arguments.Count) {
|
|
4920
|
+
& $addValues $arguments[$position] $typed ''
|
|
4921
|
+
} elseif ($arguments.Count -gt 0 -and $arguments[-1].variadic) {
|
|
4922
|
+
& $addValues $arguments[-1] $typed ''
|
|
4923
|
+
}
|
|
4924
|
+
|
|
4925
|
+
if (-not $endOfOptions) {
|
|
4926
|
+
& $addFlags $typed
|
|
4927
|
+
}
|
|
4928
|
+
return $results`;
|
|
4929
|
+
/** @internal */
|
|
4930
|
+
const generate$2 = (executableName, descriptor) => {
|
|
4931
|
+
const dataName = `$global:_${sanitize$1(executableName)}_Completions`;
|
|
4932
|
+
const lines = [];
|
|
4933
|
+
lines.push(`###-begin-${executableName}-completions-###`);
|
|
4934
|
+
lines.push(`#`);
|
|
4935
|
+
lines.push(`# Static completion script for PowerShell`);
|
|
4936
|
+
lines.push(`#`);
|
|
4937
|
+
lines.push(`# Installation:`);
|
|
4938
|
+
lines.push(`# ${executableName} --completions powershell > ${executableName}-completion.ps1`);
|
|
4939
|
+
lines.push(`# then add this line to your $PROFILE (use the full path to the file):`);
|
|
4940
|
+
lines.push(`# . <PATH>\\${executableName}-completion.ps1`);
|
|
4941
|
+
lines.push(`#`);
|
|
4942
|
+
lines.push(``);
|
|
4943
|
+
lines.push(`${dataName} = [hashtable]::new([System.StringComparer]::Ordinal)`);
|
|
4944
|
+
generateContexts(dataName, descriptor, [], lines, /* @__PURE__ */ new Set());
|
|
4945
|
+
lines.push(``);
|
|
4946
|
+
lines.push(`Register-ArgumentCompleter -Native -CommandName ${quotePs(executableName)} -ScriptBlock {`);
|
|
4947
|
+
lines.push(completer(dataName));
|
|
4948
|
+
lines.push(`}`);
|
|
4949
|
+
lines.push(``);
|
|
4950
|
+
lines.push(`###-end-${executableName}-completions-###`);
|
|
4951
|
+
return lines.join("\n");
|
|
4952
|
+
};
|
|
4953
|
+
//#endregion
|
|
4954
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/zsh.js
|
|
4660
4955
|
const escapeZsh = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "'\\''").replace(/:/g, "\\:");
|
|
4956
|
+
const escapeZshExplanation = (s) => escapeZsh(s).replace(/]/g, "\\]");
|
|
4661
4957
|
/** Escape choices for the second parse of a Zsh `_arguments` action. */
|
|
4662
4958
|
const escapeZshChoice = (s) => s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&").replace(/'/g, "'\\''");
|
|
4663
4959
|
const sanitize = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
@@ -4694,7 +4990,7 @@ const argAction = (type) => {
|
|
|
4694
4990
|
*/
|
|
4695
4991
|
const flagSpecs = (flag) => {
|
|
4696
4992
|
const specs = [];
|
|
4697
|
-
const desc = flag.description ? `[${
|
|
4993
|
+
const desc = flag.description ? `[${escapeZshExplanation(flag.description)}]` : "";
|
|
4698
4994
|
const action = valueAction(flag.type);
|
|
4699
4995
|
const excl = `(${allForms(flag).join(" ")})`;
|
|
4700
4996
|
specs.push(`'${excl}--${flag.name}${desc}${action}'`);
|
|
@@ -4703,7 +4999,7 @@ const flagSpecs = (flag) => {
|
|
|
4703
4999
|
specs.push(`'${excl}${prefix}${alias}${desc}${action}'`);
|
|
4704
5000
|
}
|
|
4705
5001
|
if (flag.type._tag === "Boolean") {
|
|
4706
|
-
const negDesc = flag.description ? `[${
|
|
5002
|
+
const negDesc = flag.description ? `[${escapeZshExplanation(`Disable ${flag.name}`)}]` : "";
|
|
4707
5003
|
specs.push(`'${excl}--no-${flag.name}${negDesc}'`);
|
|
4708
5004
|
}
|
|
4709
5005
|
return specs;
|
|
@@ -4803,12 +5099,12 @@ const generate$1 = (executableName, descriptor) => {
|
|
|
4803
5099
|
return lines.join("\n");
|
|
4804
5100
|
};
|
|
4805
5101
|
//#endregion
|
|
4806
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5102
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Completions.js
|
|
4807
5103
|
/**
|
|
4808
5104
|
* The `Completions` module turns a plain description of an Effect CLI command
|
|
4809
|
-
* tree into shell completion scripts for Bash, Zsh, and
|
|
4810
|
-
* low-level script generation surface used by the unstable CLI package
|
|
4811
|
-
* the built-in completions global flag.
|
|
5105
|
+
* tree into shell completion scripts for Bash, Zsh, Fish, and PowerShell. It
|
|
5106
|
+
* is the low-level script generation surface used by the unstable CLI package
|
|
5107
|
+
* and by the built-in completions global flag.
|
|
4812
5108
|
*
|
|
4813
5109
|
* @stability unstable
|
|
4814
5110
|
* @since 4.0.0
|
|
@@ -4823,8 +5119,8 @@ const generate$1 = (executableName, descriptor) => {
|
|
|
4823
5119
|
*
|
|
4824
5120
|
* **Details**
|
|
4825
5121
|
*
|
|
4826
|
-
* Dispatches by `shell` to Bash, Zsh, or
|
|
4827
|
-
* script string for `executableName`.
|
|
5122
|
+
* Dispatches by `shell` to Bash, Zsh, Fish, or PowerShell generation and
|
|
5123
|
+
* returns a static script string for `executableName`.
|
|
4828
5124
|
*
|
|
4829
5125
|
* @see {@link Shell} for supported shell names
|
|
4830
5126
|
* @see {@link CommandDescriptor} for the command shape used by completion generation
|
|
@@ -4835,13 +5131,14 @@ const generate$1 = (executableName, descriptor) => {
|
|
|
4835
5131
|
*/
|
|
4836
5132
|
const generate = (executableName, shell, descriptor) => {
|
|
4837
5133
|
switch (shell) {
|
|
4838
|
-
case "bash": return generate$
|
|
5134
|
+
case "bash": return generate$4(executableName, descriptor);
|
|
4839
5135
|
case "zsh": return generate$1(executableName, descriptor);
|
|
4840
|
-
case "fish": return generate$
|
|
5136
|
+
case "fish": return generate$3(executableName, descriptor);
|
|
5137
|
+
case "powershell": return generate$2(executableName, descriptor);
|
|
4841
5138
|
}
|
|
4842
5139
|
};
|
|
4843
5140
|
//#endregion
|
|
4844
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5141
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Flag.js
|
|
4845
5142
|
/**
|
|
4846
5143
|
* Creates a string flag that accepts text input.
|
|
4847
5144
|
*
|
|
@@ -4906,16 +5203,6 @@ const Boolean = (name) => Boolean$1(flagKind, name);
|
|
|
4906
5203
|
*/
|
|
4907
5204
|
const ChoiceWithValue = (name, choices) => ChoiceWithValue$1(flagKind, name, choices);
|
|
4908
5205
|
/**
|
|
4909
|
-
* Accepts one of the provided strings. An empty array rejects all input.
|
|
4910
|
-
*
|
|
4911
|
-
* @see {@link ChoiceWithValue} for mapping accepted strings to different typed values
|
|
4912
|
-
*
|
|
4913
|
-
* @stability unstable
|
|
4914
|
-
* @category constructors
|
|
4915
|
-
* @since 4.0.0
|
|
4916
|
-
*/
|
|
4917
|
-
const Literals = (name, literals) => Literals$1(flagKind, name, literals);
|
|
4918
|
-
/**
|
|
4919
5206
|
* Adds an alias to a flag, allowing it to be referenced by multiple names.
|
|
4920
5207
|
*
|
|
4921
5208
|
* **Example** (Adding flag aliases)
|
|
@@ -5085,33 +5372,8 @@ const withDefault = withDefault$1;
|
|
|
5085
5372
|
* @since 4.0.0
|
|
5086
5373
|
*/
|
|
5087
5374
|
const withFallbackConfig = /*#__PURE__*/ dual(2, (self, config) => withFallbackConfig$1(self, config));
|
|
5088
|
-
/**
|
|
5089
|
-
* Transforms the parsed value of a flag using a mapping function.
|
|
5090
|
-
*
|
|
5091
|
-
* **Example** (Mapping parsed values)
|
|
5092
|
-
*
|
|
5093
|
-
* ```ts import.meta.vitest
|
|
5094
|
-
* import { Flag } from "effect/cli"
|
|
5095
|
-
*
|
|
5096
|
-
* // Convert string to uppercase
|
|
5097
|
-
* const nameFlag = Flag.String("name").pipe(
|
|
5098
|
-
* Flag.map((name) => name.toUpperCase())
|
|
5099
|
-
* )
|
|
5100
|
-
*
|
|
5101
|
-
* // Convert port to URL
|
|
5102
|
-
* const urlFlag = Flag.Int("port").pipe(
|
|
5103
|
-
* Flag.map((port) => `http://localhost:${port}`)
|
|
5104
|
-
* )
|
|
5105
|
-
* const kinds = [nameFlag.kind, urlFlag.kind] // => ["flag", "flag"]
|
|
5106
|
-
* ```
|
|
5107
|
-
*
|
|
5108
|
-
* @stability unstable
|
|
5109
|
-
* @category mapping
|
|
5110
|
-
* @since 4.0.0
|
|
5111
|
-
*/
|
|
5112
|
-
const map = /*#__PURE__*/ dual(2, (self, f) => map$1(self, f));
|
|
5113
5375
|
//#endregion
|
|
5114
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5376
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/config.js
|
|
5115
5377
|
/**
|
|
5116
5378
|
* Config Internal
|
|
5117
5379
|
* ================
|
|
@@ -5232,7 +5494,7 @@ const reconstructTree = (tree, results) => {
|
|
|
5232
5494
|
}
|
|
5233
5495
|
};
|
|
5234
5496
|
//#endregion
|
|
5235
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5497
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/command.js
|
|
5236
5498
|
/**
|
|
5237
5499
|
* Command Implementation
|
|
5238
5500
|
* ======================
|
|
@@ -5303,7 +5565,7 @@ const makeCommand = (options) => {
|
|
|
5303
5565
|
if (visible.length === 0) continue;
|
|
5304
5566
|
subcommandDocs.push({
|
|
5305
5567
|
group: group.group,
|
|
5306
|
-
commands: map$
|
|
5568
|
+
commands: map$4(visible, (subcommand) => ({
|
|
5307
5569
|
name: subcommand.name,
|
|
5308
5570
|
alias: subcommand.alias,
|
|
5309
5571
|
shortDescription: subcommand.shortDescription,
|
|
@@ -5426,7 +5688,7 @@ const checkForDuplicateFlags = (parent, subcommands, options) => {
|
|
|
5426
5688
|
}
|
|
5427
5689
|
};
|
|
5428
5690
|
//#endregion
|
|
5429
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5691
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/descriptor.js
|
|
5430
5692
|
/**
|
|
5431
5693
|
* CommandDescriptor — pure-data representation of a command tree for
|
|
5432
5694
|
* shell completion generation.
|
|
@@ -5536,7 +5798,7 @@ const fromCommand = (cmd, inheritedFlags = []) => {
|
|
|
5536
5798
|
};
|
|
5537
5799
|
};
|
|
5538
5800
|
//#endregion
|
|
5539
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5801
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/help.js
|
|
5540
5802
|
/**
|
|
5541
5803
|
* Help Documentation
|
|
5542
5804
|
* ================
|
|
@@ -5646,7 +5908,7 @@ const getHelpForCommandPath = (command, commandPath, builtIns) => gen(function*
|
|
|
5646
5908
|
};
|
|
5647
5909
|
});
|
|
5648
5910
|
//#endregion
|
|
5649
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5911
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/GlobalFlag.js
|
|
5650
5912
|
/**
|
|
5651
5913
|
* Global flags for Effect CLI command trees. Global flags are parsed outside a
|
|
5652
5914
|
* single command's local flags and can apply to a command and its descendants.
|
|
@@ -5748,20 +6010,22 @@ const Wizard = /*#__PURE__*/ Action({
|
|
|
5748
6010
|
*
|
|
5749
6011
|
* **Details**
|
|
5750
6012
|
*
|
|
5751
|
-
* Accepted values are `bash`, `zsh`, `fish`,
|
|
5752
|
-
* `bash`.
|
|
6013
|
+
* Accepted values are `bash`, `zsh`, `fish`, `powershell`, `sh`, and `pwsh`;
|
|
6014
|
+
* `sh` is normalized to `bash` and `pwsh` to `powershell`.
|
|
5753
6015
|
*
|
|
5754
6016
|
* @stability unstable
|
|
5755
6017
|
* @category references
|
|
5756
6018
|
* @since 4.0.0
|
|
5757
6019
|
*/
|
|
5758
6020
|
const Completions = /*#__PURE__*/ Action({
|
|
5759
|
-
flag: /*#__PURE__*/
|
|
5760
|
-
"bash",
|
|
5761
|
-
"zsh",
|
|
5762
|
-
"fish",
|
|
5763
|
-
"
|
|
5764
|
-
|
|
6021
|
+
flag: /*#__PURE__*/ ChoiceWithValue("completions", [
|
|
6022
|
+
["bash", "bash"],
|
|
6023
|
+
["zsh", "zsh"],
|
|
6024
|
+
["fish", "fish"],
|
|
6025
|
+
["powershell", "powershell"],
|
|
6026
|
+
["sh", "bash"],
|
|
6027
|
+
["pwsh", "powershell"]
|
|
6028
|
+
]).pipe(optional, /*#__PURE__*/ withMetavar("<bash|zsh|fish|powershell|sh|pwsh>"), /*#__PURE__*/ withDescription$1("Print shell completion script")),
|
|
5765
6029
|
run: /*#__PURE__*/ fnUntraced(function* (shell, { command }) {
|
|
5766
6030
|
if (isNone(shell)) return;
|
|
5767
6031
|
const descriptor = fromCommand(command);
|
|
@@ -5827,7 +6091,7 @@ const BuiltIns = [
|
|
|
5827
6091
|
LogLevel
|
|
5828
6092
|
];
|
|
5829
6093
|
//#endregion
|
|
5830
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
6094
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/CliConfig.js
|
|
5831
6095
|
/**
|
|
5832
6096
|
* Configuration for Effect CLI command execution.
|
|
5833
6097
|
*
|
|
@@ -5857,7 +6121,7 @@ var CliConfig = class extends (/*#__PURE__*/ Reference("effect/cli/CliConfig", {
|
|
|
5857
6121
|
*/
|
|
5858
6122
|
const defaults = { builtIns: BuiltIns };
|
|
5859
6123
|
//#endregion
|
|
5860
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
6124
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/lexer.js
|
|
5861
6125
|
/**
|
|
5862
6126
|
* @internal
|
|
5863
6127
|
*/
|
|
@@ -5919,7 +6183,7 @@ const lexTokens = (args) => {
|
|
|
5919
6183
|
return tokens;
|
|
5920
6184
|
};
|
|
5921
6185
|
//#endregion
|
|
5922
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
6186
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/auto-suggest.js
|
|
5923
6187
|
/**
|
|
5924
6188
|
* Simple Levenshtein distance implementation (small N, no perf worries)
|
|
5925
6189
|
*/
|
|
@@ -5947,7 +6211,7 @@ const suggest = (input, candidates) => {
|
|
|
5947
6211
|
return distances.filter(([d]) => d === minDistance).map(([, c]) => c);
|
|
5948
6212
|
};
|
|
5949
6213
|
//#endregion
|
|
5950
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
6214
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/parser.js
|
|
5951
6215
|
/**
|
|
5952
6216
|
* Parsing Pipeline for CLI Commands
|
|
5953
6217
|
* ==================================
|
|
@@ -6479,13 +6743,14 @@ const scanCommandLevel = (tokens, context) => {
|
|
|
6479
6743
|
return toLeafResult(state);
|
|
6480
6744
|
};
|
|
6481
6745
|
//#endregion
|
|
6482
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
6746
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/wizard.js
|
|
6483
6747
|
const run$1 = /*#__PURE__*/ fnUntraced(function* (command, options) {
|
|
6484
6748
|
const commandPath = options?.commandPath ?? [command.name];
|
|
6485
6749
|
const selected = getCommandAtPath(command, commandPath);
|
|
6486
6750
|
const commandLine = (options?.prefix ?? commandPath).map((value) => commandLineArg(value));
|
|
6487
|
-
yield*
|
|
6488
|
-
yield*
|
|
6751
|
+
const { colors } = yield* Theme;
|
|
6752
|
+
yield* logCurrentCommand(commandLine, colors);
|
|
6753
|
+
yield* promptCommand(selected, commandLine, selected === command ? "ROOT" : selected.name, colors);
|
|
6489
6754
|
return {
|
|
6490
6755
|
args: commandLine.map((arg) => arg.value),
|
|
6491
6756
|
displayArgs: commandLine.map((arg) => arg.displayValue)
|
|
@@ -6500,19 +6765,19 @@ const getCommandAtPath = (command, commandPath) => {
|
|
|
6500
6765
|
}
|
|
6501
6766
|
return current;
|
|
6502
6767
|
};
|
|
6503
|
-
const promptCommand = /*#__PURE__*/ fnUntraced(function* (command, commandLine, sectionName) {
|
|
6768
|
+
const promptCommand = /*#__PURE__*/ fnUntraced(function* (command, commandLine, sectionName, colors) {
|
|
6504
6769
|
const impl = toImpl(command);
|
|
6505
6770
|
const visibleSubcommands = command.subcommands.flatMap((group) => group.commands.filter((child) => !child.unlisted));
|
|
6506
6771
|
const config = visibleSubcommands.length === 0 ? impl.config : impl.contextConfig;
|
|
6507
6772
|
if (config.flags.length > 0) {
|
|
6508
|
-
yield* log(renderSection(sectionName, "FLAGS"));
|
|
6773
|
+
yield* log(renderSection(sectionName, "FLAGS", colors));
|
|
6509
6774
|
for (const param of config.flags) commandLine.push(...yield* promptParam(param));
|
|
6510
|
-
if (config.arguments.length > 0 || visibleSubcommands.length > 0) yield* logCurrentCommand(commandLine);
|
|
6775
|
+
if (config.arguments.length > 0 || visibleSubcommands.length > 0) yield* logCurrentCommand(commandLine, colors);
|
|
6511
6776
|
}
|
|
6512
6777
|
if (config.arguments.length > 0) {
|
|
6513
|
-
yield* log(renderSection(sectionName, "ARGUMENTS"));
|
|
6778
|
+
yield* log(renderSection(sectionName, "ARGUMENTS", colors));
|
|
6514
6779
|
for (const param of config.arguments) commandLine.push(...yield* promptParam(param));
|
|
6515
|
-
if (visibleSubcommands.length > 0) yield* logCurrentCommand(commandLine);
|
|
6780
|
+
if (visibleSubcommands.length > 0) yield* logCurrentCommand(commandLine, colors);
|
|
6516
6781
|
}
|
|
6517
6782
|
if (visibleSubcommands.length === 0) return;
|
|
6518
6783
|
const child = yield* run$2(Select({
|
|
@@ -6525,8 +6790,8 @@ const promptCommand = /*#__PURE__*/ fnUntraced(function* (command, commandLine,
|
|
|
6525
6790
|
}));
|
|
6526
6791
|
yield* log();
|
|
6527
6792
|
commandLine.push(commandLineArg(child.name));
|
|
6528
|
-
if (hasWizardSteps(child)) yield* logCurrentCommand(commandLine);
|
|
6529
|
-
yield* promptCommand(child, commandLine, child.name);
|
|
6793
|
+
if (hasWizardSteps(child)) yield* logCurrentCommand(commandLine, colors);
|
|
6794
|
+
yield* promptCommand(child, commandLine, child.name, colors);
|
|
6530
6795
|
});
|
|
6531
6796
|
const hasWizardSteps = (command) => {
|
|
6532
6797
|
return command.subcommands.some((group) => group.commands.some((child) => !child.unlisted)) || toImpl(command).config.orderedParams.length > 0;
|
|
@@ -6566,7 +6831,7 @@ const promptParam = /*#__PURE__*/ fnUntraced(function* (param) {
|
|
|
6566
6831
|
const promptSingle = (single) => {
|
|
6567
6832
|
const message = renderParamMessage(single);
|
|
6568
6833
|
switch (single.primitiveType._tag) {
|
|
6569
|
-
case "Boolean": return map$
|
|
6834
|
+
case "Boolean": return map$2(run$2(Confirm({
|
|
6570
6835
|
message,
|
|
6571
6836
|
label: {
|
|
6572
6837
|
confirm: "true",
|
|
@@ -6579,7 +6844,7 @@ const promptSingle = (single) => {
|
|
|
6579
6844
|
})), (value) => commandLineArg(String(value)));
|
|
6580
6845
|
case "Choice": {
|
|
6581
6846
|
const choices = getChoiceKeys(single.primitiveType) ?? [];
|
|
6582
|
-
return map$
|
|
6847
|
+
return map$2(run$2(Select({
|
|
6583
6848
|
message,
|
|
6584
6849
|
choices: choices.map((choice) => ({
|
|
6585
6850
|
title: choice,
|
|
@@ -6587,11 +6852,11 @@ const promptSingle = (single) => {
|
|
|
6587
6852
|
}))
|
|
6588
6853
|
})), commandLineArg);
|
|
6589
6854
|
}
|
|
6590
|
-
case "Date": return map$
|
|
6591
|
-
case "Finite": return map$
|
|
6592
|
-
case "Int": return map$
|
|
6593
|
-
case "Redacted": return map$
|
|
6594
|
-
default: return map$
|
|
6855
|
+
case "Date": return map$2(run$2(Date({ message })), (date) => commandLineArg(date.toISOString()));
|
|
6856
|
+
case "Finite": return map$2(run$2(Number$1({ message })), (value) => commandLineArg(String(value)));
|
|
6857
|
+
case "Int": return map$2(run$2(Int({ message })), (value) => commandLineArg(String(value)));
|
|
6858
|
+
case "Redacted": return map$2(run$2(Password({ message })), (value$1) => commandLineArg(value(value$1), "<redacted>"));
|
|
6859
|
+
default: return map$2(run$2(String$4({ message })), commandLineArg);
|
|
6595
6860
|
}
|
|
6596
6861
|
};
|
|
6597
6862
|
const commandLineArg = (value, displayValue = value) => ({
|
|
@@ -6610,23 +6875,23 @@ const humanize = (name) => {
|
|
|
6610
6875
|
if (words.length === 0) return name;
|
|
6611
6876
|
return [words[0][0].toUpperCase() + words[0].slice(1), ...words.slice(1)].join(" ");
|
|
6612
6877
|
};
|
|
6613
|
-
const logCurrentCommand = (commandLine) => log(renderCommandBlock("Current command", commandLine.map((arg) => arg.displayValue), magenta));
|
|
6614
|
-
const renderSection = (commandName, section) => `${annotate(commandName.toUpperCase(), bold, cyanBright)} ${annotate("·", blackBright)} ${annotate(section, bold, white)}`;
|
|
6615
|
-
const renderIntroduction = (name, version, summary) => {
|
|
6878
|
+
const logCurrentCommand = (commandLine, colors) => log(renderCommandBlock("Current command", commandLine.map((arg) => arg.displayValue), colors, magenta));
|
|
6879
|
+
const renderSection = (commandName, section, colors) => `${annotate(colors, commandName.toUpperCase(), bold, cyanBright)} ${annotate(colors, "·", blackBright)} ${annotate(colors, section, bold, white)}`;
|
|
6880
|
+
const renderIntroduction = (name, version, summary, colors) => {
|
|
6616
6881
|
return [
|
|
6617
|
-
`${annotate(name, bold, cyanBright)} ${annotate(`v${version}`, white)} ${annotate("· Command wizard", bold, white)}`,
|
|
6882
|
+
`${annotate(colors, name, bold, cyanBright)} ${annotate(colors, `v${version}`, white)} ${annotate(colors, "· Command wizard", bold, white)}`,
|
|
6618
6883
|
...summary === void 0 || summary.length === 0 ? [] : [summary],
|
|
6619
|
-
annotate("Build a command interactively. Press Ctrl+C to cancel.", blackBright),
|
|
6884
|
+
annotate(colors, "Build a command interactively. Press Ctrl+C to cancel.", blackBright),
|
|
6620
6885
|
""
|
|
6621
6886
|
].join("\n");
|
|
6622
6887
|
};
|
|
6623
|
-
const renderCompletion = (commandLine) => renderCommandBlock("Command ready", commandLine, cyanBright, green);
|
|
6624
|
-
const renderQuit = () => `\n${annotate("Wizard cancelled.", red)}`;
|
|
6625
|
-
const renderCommandBlock = (label, commandLine, commandColor, labelColor = white) => {
|
|
6888
|
+
const renderCompletion = (commandLine, colors) => renderCommandBlock("Command ready", commandLine, colors, cyanBright, green);
|
|
6889
|
+
const renderQuit = (colors) => `\n${annotate(colors, "Wizard cancelled.", red)}`;
|
|
6890
|
+
const renderCommandBlock = (label, commandLine, colors, commandColor, labelColor = white) => {
|
|
6626
6891
|
const lines = wrapCommand(commandLine);
|
|
6627
6892
|
return [
|
|
6628
|
-
annotate(label, bold, labelColor),
|
|
6629
|
-
...lines.map((line) => annotate(line, commandColor)),
|
|
6893
|
+
annotate(colors, label, bold, labelColor),
|
|
6894
|
+
...lines.map((line) => annotate(colors, line, commandColor)),
|
|
6630
6895
|
""
|
|
6631
6896
|
].join("\n");
|
|
6632
6897
|
};
|
|
@@ -6649,7 +6914,7 @@ const wrapCommand = (commandLine) => {
|
|
|
6649
6914
|
};
|
|
6650
6915
|
const formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
|
|
6651
6916
|
//#endregion
|
|
6652
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
6917
|
+
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Command.js
|
|
6653
6918
|
/**
|
|
6654
6919
|
* Returns `true` if the provided value is a `Command`.
|
|
6655
6920
|
*
|
|
@@ -7205,27 +7470,30 @@ const runWith = (command, config) => {
|
|
|
7205
7470
|
return entries !== void 0 && entries.length > 0;
|
|
7206
7471
|
})) continue;
|
|
7207
7472
|
const [, value] = yield* flag.flag.parse(emptyArgs);
|
|
7208
|
-
if (flag === Wizard)
|
|
7209
|
-
yield*
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7473
|
+
if (flag === Wizard) {
|
|
7474
|
+
const { colors } = yield* Theme;
|
|
7475
|
+
return yield* gen(function* () {
|
|
7476
|
+
yield* log(renderIntroduction(command.name, config.version, command.description, colors));
|
|
7477
|
+
const prefix = [command.name, ...args.filter((arg) => arg !== "--wizard" && !arg.startsWith("--wizard="))];
|
|
7478
|
+
const wizardResult = yield* run$1(command, {
|
|
7479
|
+
commandPath,
|
|
7480
|
+
prefix
|
|
7481
|
+
});
|
|
7482
|
+
yield* log(renderCompletion(wizardResult.displayArgs, colors));
|
|
7483
|
+
if (yield* run$2(Toggle({
|
|
7484
|
+
message: "Run this command?",
|
|
7485
|
+
initial: true,
|
|
7486
|
+
active: "yes",
|
|
7487
|
+
inactive: "no"
|
|
7488
|
+
}))) {
|
|
7489
|
+
yield* log();
|
|
7490
|
+
yield* runWith(command, {
|
|
7491
|
+
...config,
|
|
7492
|
+
renderErrors: false
|
|
7493
|
+
})(wizardResult.args.slice(1));
|
|
7494
|
+
}
|
|
7495
|
+
}).pipe(catchTag("QuitError", () => log(renderQuit(colors))));
|
|
7496
|
+
}
|
|
7229
7497
|
yield* flag.run(value, handlerCtx);
|
|
7230
7498
|
return;
|
|
7231
7499
|
}
|
|
@@ -7255,7 +7523,7 @@ const runWith = (command, config) => {
|
|
|
7255
7523
|
};
|
|
7256
7524
|
//#endregion
|
|
7257
7525
|
//#region package.json
|
|
7258
|
-
var version = "0.1.
|
|
7526
|
+
var version = "0.1.1069";
|
|
7259
7527
|
//#endregion
|
|
7260
7528
|
//#region src/main.cli.ts
|
|
7261
7529
|
function section(title, text) {
|
|
@@ -7268,7 +7536,7 @@ const save = pipe(make("save", {
|
|
|
7268
7536
|
const note = yield* pipe(gen(function* () {
|
|
7269
7537
|
const client = yield* make$1(RpcContracts);
|
|
7270
7538
|
const saved = yield* client["notes.capture"]({
|
|
7271
|
-
id: yield* (yield* Crypto).randomUUIDv4,
|
|
7539
|
+
id: yield* (yield* Crypto).randomUUIDv4(),
|
|
7272
7540
|
text: input.entry
|
|
7273
7541
|
});
|
|
7274
7542
|
yield* logInfo("Saved; the server is reading and tagging it, which takes minutes for a long video");
|
|
@@ -7285,7 +7553,7 @@ const save = pipe(make("save", {
|
|
|
7285
7553
|
note.source,
|
|
7286
7554
|
note.url ?? ""
|
|
7287
7555
|
], isNonEmpty), " · "),
|
|
7288
|
-
join(map$
|
|
7556
|
+
join(map$4(note.tags, (name) => `#${name}`), " "),
|
|
7289
7557
|
note.summary,
|
|
7290
7558
|
section("Notes", note.body ?? ""),
|
|
7291
7559
|
section("Topics", note.topics ?? ""),
|