@oakoliver/gum 1.0.1
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/LICENSE +22 -0
- package/dist/cjs/index.cjs +2161 -0
- package/dist/esm/cli.js +2033 -0
- package/dist/esm/index.js +2104 -0
- package/dist/types/cli.d.ts +7 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/commands/choose.d.ts +7 -0
- package/dist/types/commands/choose.d.ts.map +1 -0
- package/dist/types/commands/confirm.d.ts +7 -0
- package/dist/types/commands/confirm.d.ts.map +1 -0
- package/dist/types/commands/file.d.ts +7 -0
- package/dist/types/commands/file.d.ts.map +1 -0
- package/dist/types/commands/format.d.ts +7 -0
- package/dist/types/commands/format.d.ts.map +1 -0
- package/dist/types/commands/input.d.ts +7 -0
- package/dist/types/commands/input.d.ts.map +1 -0
- package/dist/types/commands/join.d.ts +7 -0
- package/dist/types/commands/join.d.ts.map +1 -0
- package/dist/types/commands/log.d.ts +7 -0
- package/dist/types/commands/log.d.ts.map +1 -0
- package/dist/types/commands/pager.d.ts +7 -0
- package/dist/types/commands/pager.d.ts.map +1 -0
- package/dist/types/commands/spin.d.ts +7 -0
- package/dist/types/commands/spin.d.ts.map +1 -0
- package/dist/types/commands/style.d.ts +7 -0
- package/dist/types/commands/style.d.ts.map +1 -0
- package/dist/types/commands/table.d.ts +7 -0
- package/dist/types/commands/table.d.ts.map +1 -0
- package/dist/types/commands/write.d.ts +7 -0
- package/dist/types/commands/write.d.ts.map +1 -0
- package/dist/types/fuzzy.d.ts +36 -0
- package/dist/types/fuzzy.d.ts.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/internal/decode.d.ts +11 -0
- package/dist/types/internal/decode.d.ts.map +1 -0
- package/dist/types/internal/exit.d.ts +9 -0
- package/dist/types/internal/exit.d.ts.map +1 -0
- package/dist/types/internal/files.d.ts +9 -0
- package/dist/types/internal/files.d.ts.map +1 -0
- package/dist/types/internal/index.d.ts +7 -0
- package/dist/types/internal/index.d.ts.map +1 -0
- package/dist/types/internal/stdin.d.ts +21 -0
- package/dist/types/internal/stdin.d.ts.map +1 -0
- package/dist/types/internal/timeout.d.ts +18 -0
- package/dist/types/internal/timeout.d.ts.map +1 -0
- package/dist/types/internal/tty.d.ts +13 -0
- package/dist/types/internal/tty.d.ts.map +1 -0
- package/dist/types/parser.d.ts +36 -0
- package/dist/types/parser.d.ts.map +1 -0
- package/dist/types/style.d.ts +37 -0
- package/dist/types/style.d.ts.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choose.d.ts","sourceRoot":"","sources":["../../../src/commands/choose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyQ/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/commands/confirm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgH/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAe3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/commands/file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwK/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/commands/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiE/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/commands/input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA6H/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAU3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../../src/commands/join.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/commands/log.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoI/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwD3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pager.d.ts","sourceRoot":"","sources":["../../../src/commands/pager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoW/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin.d.ts","sourceRoot":"","sources":["../../../src/commands/spin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwJ/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/commands/style.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/commands/table.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA2J/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA2G3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/commands/write.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+H/C,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAU3D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuzzy matching implementation.
|
|
3
|
+
* Port of sahilm/fuzzy for use by the filter command.
|
|
4
|
+
*/
|
|
5
|
+
export interface FuzzyMatch {
|
|
6
|
+
/** The original string that matched. */
|
|
7
|
+
str: string;
|
|
8
|
+
/** The index of the match in the original list. */
|
|
9
|
+
index: number;
|
|
10
|
+
/** Byte positions of matched characters in the original string. */
|
|
11
|
+
matchedIndexes: number[];
|
|
12
|
+
/** Score for ranking. */
|
|
13
|
+
score: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Find fuzzy matches for a pattern in a list of choices.
|
|
17
|
+
* Returns matches sorted by score (best first).
|
|
18
|
+
*/
|
|
19
|
+
export declare function fuzzyFind(pattern: string, choices: string[]): FuzzyMatch[];
|
|
20
|
+
/**
|
|
21
|
+
* Find fuzzy matches without sorting.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fuzzyFindNoSort(pattern: string, choices: string[]): FuzzyMatch[];
|
|
24
|
+
/**
|
|
25
|
+
* Create matches for all items (no filter).
|
|
26
|
+
*/
|
|
27
|
+
export declare function matchAll(choices: string[]): FuzzyMatch[];
|
|
28
|
+
/**
|
|
29
|
+
* Exact substring match.
|
|
30
|
+
*/
|
|
31
|
+
export declare function exactMatches(search: string, choices: string[]): FuzzyMatch[];
|
|
32
|
+
/**
|
|
33
|
+
* Convert array of matched indexes to ranges [start, end].
|
|
34
|
+
*/
|
|
35
|
+
export declare function matchedRanges(indexes: number[]): [number, number][];
|
|
36
|
+
//# sourceMappingURL=fuzzy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../../src/fuzzy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAqB1E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAoBhF;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAOxD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CA0B5E;AAyCD;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAoBnE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oakoliver/gum - A tool for glamorous shell scripts
|
|
3
|
+
* TypeScript port of charmbracelet/gum
|
|
4
|
+
*/
|
|
5
|
+
export * from './fuzzy';
|
|
6
|
+
export * from './style';
|
|
7
|
+
export * from './parser';
|
|
8
|
+
export { run as runChoose } from './commands/choose';
|
|
9
|
+
export { run as runConfirm } from './commands/confirm';
|
|
10
|
+
export { run as runFile } from './commands/file';
|
|
11
|
+
export { run as runFormat } from './commands/format';
|
|
12
|
+
export { run as runInput } from './commands/input';
|
|
13
|
+
export { run as runJoin } from './commands/join';
|
|
14
|
+
export { run as runLog } from './commands/log';
|
|
15
|
+
export { run as runPager } from './commands/pager';
|
|
16
|
+
export { run as runSpin } from './commands/spin';
|
|
17
|
+
export { run as runStyle } from './commands/style';
|
|
18
|
+
export { run as runTable } from './commands/table';
|
|
19
|
+
export { run as runWrite } from './commands/write';
|
|
20
|
+
export * from './internal/files';
|
|
21
|
+
export * from './internal/stdin';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,GAAG,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alignment and border decode utilities.
|
|
3
|
+
* Port of charmbracelet/gum/internal/decode and charmbracelet/gum/style
|
|
4
|
+
*/
|
|
5
|
+
/** Map alignment strings to lipgloss Position values. */
|
|
6
|
+
export declare const alignMap: Record<string, number>;
|
|
7
|
+
/** Map border style names to lipgloss border getter names. */
|
|
8
|
+
export declare const borderMap: Record<string, string>;
|
|
9
|
+
/** Map cursor mode strings. */
|
|
10
|
+
export declare const cursorModes: Record<string, string>;
|
|
11
|
+
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/internal/decode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yDAAyD;AACzD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO3C,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO5C,CAAC;AAEF,+BAA+B;AAC/B,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI9C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit code constants.
|
|
3
|
+
* Port of charmbracelet/gum/internal/exit
|
|
4
|
+
*/
|
|
5
|
+
/** Exit code for timed out commands. */
|
|
6
|
+
export declare const STATUS_TIMEOUT = 124;
|
|
7
|
+
/** Exit code for aborted commands (ctrl+c). */
|
|
8
|
+
export declare const STATUS_ABORTED = 130;
|
|
9
|
+
//# sourceMappingURL=exit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../../src/internal/exit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wCAAwC;AACxC,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,+CAA+C;AAC/C,eAAO,MAAM,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File listing utilities.
|
|
3
|
+
* Port of charmbracelet/gum/internal/files
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* List all files recursively from the current directory, ignoring .git and node_modules.
|
|
7
|
+
*/
|
|
8
|
+
export declare function listFiles(dir?: string): string[];
|
|
9
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/internal/files.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,SAAM,GAAG,MAAM,EAAE,CAyB7C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { readStdin, isStdinEmpty, stripAnsi } from './stdin.js';
|
|
2
|
+
export { STATUS_TIMEOUT, STATUS_ABORTED } from './exit.js';
|
|
3
|
+
export { createTimeout, parseDuration } from './timeout.js';
|
|
4
|
+
export { isTTY, println } from './tty.js';
|
|
5
|
+
export { listFiles } from './files.js';
|
|
6
|
+
export { alignMap, borderMap, cursorModes } from './decode.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal stdin utilities for reading piped input.
|
|
3
|
+
* Port of charmbracelet/gum/internal/stdin
|
|
4
|
+
*/
|
|
5
|
+
export interface ReadOptions {
|
|
6
|
+
stripAnsi?: boolean;
|
|
7
|
+
singleLine?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Strip ANSI escape sequences from a string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stripAnsi(s: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Check if stdin has piped data available.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isStdinEmpty(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Read all data from stdin synchronously.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readStdin(opts?: ReadOptions): string;
|
|
21
|
+
//# sourceMappingURL=stdin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdin.d.ts","sourceRoot":"","sources":["../../../src/internal/stdin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3C;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAUtC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,GAAE,WAAgB,GAAG,MAAM,CAyCxD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeout utilities.
|
|
3
|
+
* Port of charmbracelet/gum/internal/timeout
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create a timeout context (returns an AbortController).
|
|
7
|
+
* If timeoutMs is 0, returns a controller that never aborts.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTimeout(timeoutMs: number): {
|
|
10
|
+
controller: AbortController;
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Parse a duration string like "5s", "100ms", "2m" into milliseconds.
|
|
15
|
+
* Returns 0 for "0s" or "0".
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseDuration(s: string): number;
|
|
18
|
+
//# sourceMappingURL=timeout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../../src/internal/timeout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAUpG;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAgB/C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TTY-aware output utilities.
|
|
3
|
+
* Port of charmbracelet/gum/internal/tty
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if stdout is a TTY.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isTTY(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Print a line, stripping ANSI if stdout is not a TTY.
|
|
11
|
+
*/
|
|
12
|
+
export declare function println(s: string): void;
|
|
13
|
+
//# sourceMappingURL=tty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tty.d.ts","sourceRoot":"","sources":["../../../src/internal/tty.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAMvC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI argument parser.
|
|
3
|
+
* Replaces alecthomas/kong for the gum CLI.
|
|
4
|
+
* Handles: gum <subcommand> [--flag value] [--flag=value] [--bool-flag] [args...]
|
|
5
|
+
*/
|
|
6
|
+
export interface ParsedArgs {
|
|
7
|
+
/** The subcommand (e.g., "choose", "confirm", "input") */
|
|
8
|
+
command: string;
|
|
9
|
+
/** Named flags (--key value or --key=value) */
|
|
10
|
+
flags: Record<string, string | boolean>;
|
|
11
|
+
/** Positional arguments (everything after flags, or after --) */
|
|
12
|
+
args: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse argv into a structured command + flags + args.
|
|
16
|
+
* Expects argv WITHOUT the first two entries (node binary + script path).
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
19
|
+
/**
|
|
20
|
+
* Get a flag value as a string, with a default.
|
|
21
|
+
*/
|
|
22
|
+
export declare function flagStr(flags: Record<string, string | boolean>, key: string, defaultValue: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get a flag value as a number, with a default.
|
|
25
|
+
*/
|
|
26
|
+
export declare function flagInt(flags: Record<string, string | boolean>, key: string, defaultValue: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Get a flag value as a boolean.
|
|
29
|
+
*/
|
|
30
|
+
export declare function flagBool(flags: Record<string, string | boolean>, key: string, defaultValue?: boolean): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Get a flag value, checking env var fallback.
|
|
33
|
+
* Kong uses env:"GUM_INPUT_VALUE" pattern — we check env vars with GUM_ prefix.
|
|
34
|
+
*/
|
|
35
|
+
export declare function flagWithEnv(flags: Record<string, string | boolean>, key: string, envKey: string, defaultValue: string): string;
|
|
36
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IACxC,iEAAiE;IACjE,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAqBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA8EpD;AAiBD;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAK1G;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAK1G;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,OAAO,CAK5G;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,MAAM,CAMR"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style system — converts CLI style flags to lipgloss styles.
|
|
3
|
+
* Port of charmbracelet/gum/style
|
|
4
|
+
*/
|
|
5
|
+
import type { Style } from '@oakoliver/lipgloss';
|
|
6
|
+
/** Style options matching the Go Styles struct. */
|
|
7
|
+
export interface StyleOptions {
|
|
8
|
+
foreground?: string;
|
|
9
|
+
background?: string;
|
|
10
|
+
border?: string;
|
|
11
|
+
borderBackground?: string;
|
|
12
|
+
borderForeground?: string;
|
|
13
|
+
align?: string;
|
|
14
|
+
height?: number;
|
|
15
|
+
width?: number;
|
|
16
|
+
margin?: string;
|
|
17
|
+
padding?: string;
|
|
18
|
+
bold?: boolean;
|
|
19
|
+
faint?: boolean;
|
|
20
|
+
italic?: boolean;
|
|
21
|
+
strikethrough?: boolean;
|
|
22
|
+
underline?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse padding/margin string "1 2 3 4" into [top, right, bottom, left].
|
|
26
|
+
*/
|
|
27
|
+
export declare function parsePadding(s: string): [number, number, number, number];
|
|
28
|
+
/**
|
|
29
|
+
* Convert StyleOptions to a lipgloss Style.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toLipgloss(opts: StyleOptions): Style;
|
|
32
|
+
/**
|
|
33
|
+
* Extract style options from CLI flags with a given prefix.
|
|
34
|
+
* e.g., prefix "cursor" reads --cursor.foreground, --cursor.bold, etc.
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractStyleOptions(flags: Record<string, any>, prefix: string): StyleOptions;
|
|
37
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/style.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAkBxE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,KAAK,CAoCpD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAoB5F"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oakoliver/gum",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A tool for glamorous shell scripts. TypeScript port of charmbracelet/gum.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"gum": "./dist/esm/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"import": "./dist/esm/index.js",
|
|
13
|
+
"require": "./dist/cjs/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/cjs/index.cjs",
|
|
17
|
+
"module": "./dist/esm/index.js",
|
|
18
|
+
"types": "./dist/types/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:esm": "esbuild src/index.ts src/cli.ts --bundle --format=esm --platform=node --outdir=dist/esm --external:@oakoliver/bubbletea --external:@oakoliver/bubbles --external:@oakoliver/lipgloss --external:@oakoliver/glamour --external:@oakoliver/huh",
|
|
26
|
+
"build:cjs": "esbuild src/index.ts --bundle --format=cjs --platform=node --outdir=dist/cjs --out-extension:.js=.cjs --external:@oakoliver/bubbletea --external:@oakoliver/bubbles --external:@oakoliver/lipgloss --external:@oakoliver/glamour --external:@oakoliver/huh",
|
|
27
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist/types",
|
|
28
|
+
"build": "rm -rf dist && npm run build:esm && npm run build:cjs && npm run build:types",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "bun test",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@oakoliver/bubbletea": "^1.0.0",
|
|
35
|
+
"@oakoliver/bubbles": "^1.0.0",
|
|
36
|
+
"@oakoliver/lipgloss": "^1.0.0",
|
|
37
|
+
"@oakoliver/glamour": "^1.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^20",
|
|
41
|
+
"esbuild": "^0.27.4",
|
|
42
|
+
"typescript": "^5"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"gum",
|
|
46
|
+
"shell",
|
|
47
|
+
"scripts",
|
|
48
|
+
"cli",
|
|
49
|
+
"tui",
|
|
50
|
+
"terminal",
|
|
51
|
+
"charmbracelet",
|
|
52
|
+
"interactive",
|
|
53
|
+
"prompts",
|
|
54
|
+
"bubbletea"
|
|
55
|
+
],
|
|
56
|
+
"author": "Antonio Oliveira <antonio@oakoliver.com> (https://oakoliver.com)",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/oakoliver/gum.git"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/oakoliver/gum#readme",
|
|
63
|
+
"bugs": {
|
|
64
|
+
"url": "https://github.com/oakoliver/gum/issues"
|
|
65
|
+
}
|
|
66
|
+
}
|