view-ignored 0.4.0 → 0.4.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/bin/viewig +1 -1
- package/out/{src/browser → browser}/binds/index.d.ts +0 -19
- package/out/{src/browser → browser}/binds/index.js +1 -8
- package/out/browser/binds/plugins/git.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/git.js +3 -3
- package/out/browser/binds/plugins/npm.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/npm.js +6 -6
- package/out/browser/binds/plugins/vsce.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/vsce.js +3 -3
- package/out/browser/binds/plugins/yarn.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/yarn.js +2 -2
- package/out/{src/browser → browser}/binds/scanner.d.ts +0 -12
- package/out/{src/browser → browser}/binds/scanner.js +0 -6
- package/out/{src/browser → browser}/binds/targets.d.ts +0 -11
- package/out/{src/browser → browser}/binds/targets.js +1 -6
- package/out/{src/browser → browser}/errors.d.ts +0 -15
- package/out/{src/browser → browser}/errors.js +0 -15
- package/out/{src/browser → browser}/filtering.d.ts +0 -3
- package/out/{src/browser → browser}/filtering.js +0 -2
- package/out/{src/browser → browser}/fs/directory.d.ts +0 -53
- package/out/{src/browser → browser}/fs/directory.js +1 -4
- package/out/{src/browser → browser}/fs/file-info.d.ts +0 -5
- package/out/{src/browser → browser}/fs/file-info.js +0 -1
- package/out/{src/browser → browser}/fs/file.d.ts +0 -3
- package/out/{src/browser → browser}/fs/file.js +0 -3
- package/out/{src/browser → browser}/fs/source-info.d.ts +0 -1
- package/out/{src/browser → browser}/fs/source-info.js +0 -1
- package/out/{src/browser → browser}/lib.d.ts +1 -12
- package/out/{src/browser → browser}/lib.js +1 -4
- package/out/{src/browser → browser}/sorting.d.ts +0 -10
- package/out/{src/browser → browser}/sorting.js +0 -8
- package/out/{src/browser → browser}/styling.d.ts +0 -14
- package/out/{src/browser → browser}/styling.js +0 -7
- package/out/{src/cli.d.ts → cli.d.ts} +0 -47
- package/out/{src/cli.js → cli.js} +2 -37
- package/out/{src/config.d.ts → config.d.ts} +0 -57
- package/out/{src/config.js → config.js} +3 -45
- package/out/{src/errors.d.ts → errors.d.ts} +0 -1
- package/out/{src/styling.d.ts → styling.d.ts} +0 -6
- package/out/{src/styling.js → styling.js} +0 -6
- package/package.json +27 -35
- package/out/package.json +0 -122
- package/out/src/browser/binds/plugins/git.d.ts +0 -22
- package/out/src/browser/binds/plugins/npm.d.ts +0 -38
- package/out/src/browser/binds/plugins/vsce.d.ts +0 -25
- package/out/src/browser/binds/plugins/yarn.d.ts +0 -11
- /package/out/{src/browser → browser}/fs/index.d.ts +0 -0
- /package/out/{src/browser → browser}/fs/index.js +0 -0
- /package/out/{src/browser → browser}/index.d.ts +0 -0
- /package/out/{src/browser → browser}/index.js +0 -0
- /package/out/{src/errors.js → errors.js} +0 -0
- /package/out/{src/index.d.ts → index.d.ts} +0 -0
- /package/out/{src/index.js → index.js} +0 -0
- /package/out/{src/lib.d.ts → lib.d.ts} +0 -0
- /package/out/{src/lib.js → lib.js} +0 -0
|
@@ -6,7 +6,6 @@ import { type SourceInfo } from './source-info.js';
|
|
|
6
6
|
import { type Directory } from './directory.js';
|
|
7
7
|
/**
|
|
8
8
|
* @see {@link FileInfo.prototype.toString}
|
|
9
|
-
* @public
|
|
10
9
|
*/
|
|
11
10
|
export type FileInfoToStringOptions = {
|
|
12
11
|
/**
|
|
@@ -45,13 +44,9 @@ export type FileInfoToStringOptions = {
|
|
|
45
44
|
*/
|
|
46
45
|
entire?: boolean;
|
|
47
46
|
};
|
|
48
|
-
/**
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
47
|
export type FileInfoStatus = 'ignored' | 'included' | 'non-target';
|
|
52
48
|
/**
|
|
53
49
|
* The result of the file path scan.
|
|
54
|
-
* @public
|
|
55
50
|
*/
|
|
56
51
|
export declare class FileInfo extends File {
|
|
57
52
|
/**
|
|
@@ -10,12 +10,10 @@ export * as Sorting from './sorting.js';
|
|
|
10
10
|
export * as Plugins from './binds/index.js';
|
|
11
11
|
/**
|
|
12
12
|
* ViewIgnored's package.json.
|
|
13
|
-
|
|
14
|
-
*/
|
|
13
|
+
*/
|
|
15
14
|
export declare const package_: typeof import("../../package.json");
|
|
16
15
|
/**
|
|
17
16
|
* Uses `node:fs` and `node:fs/promises` by default.
|
|
18
|
-
* @public
|
|
19
17
|
*/
|
|
20
18
|
export type FileSystemAdapter = {
|
|
21
19
|
readFileSync?: typeof FS.readFileSync;
|
|
@@ -29,7 +27,6 @@ export type FileSystemAdapter = {
|
|
|
29
27
|
};
|
|
30
28
|
/**
|
|
31
29
|
* The custom scanner.
|
|
32
|
-
* @public
|
|
33
30
|
*/
|
|
34
31
|
export type Scanner = {
|
|
35
32
|
/**
|
|
@@ -42,12 +39,10 @@ export type Scanner = {
|
|
|
42
39
|
* @throws If the target does not allow the current ignore configurations: {@link ViewIgnoredError}.
|
|
43
40
|
* For example, {@link https://www.npmjs.com/package/@vscode/vsce vsce} considers it invalid if your manifest is missing the 'engines' field.
|
|
44
41
|
* Similarly, npm will raise an error if you attempt to publish a package without a basic 'package.json'.
|
|
45
|
-
* @public
|
|
46
42
|
*/
|
|
47
43
|
export type Methodology = (tree: Directory, realOptions: RealScanOptions) => Map<File, SourceInfo>;
|
|
48
44
|
/**
|
|
49
45
|
* Options with defaults and additional properties.
|
|
50
|
-
* @public
|
|
51
46
|
*/
|
|
52
47
|
export type RealScanOptions = Required<Omit<ScanOptions, 'fsa'>> & {
|
|
53
48
|
modules: {
|
|
@@ -63,7 +58,6 @@ export type RealScanOptions = Required<Omit<ScanOptions, 'fsa'>> & {
|
|
|
63
58
|
};
|
|
64
59
|
/**
|
|
65
60
|
* Folder deep scanning options.
|
|
66
|
-
* @public
|
|
67
61
|
*/
|
|
68
62
|
export type ScanOptions = {
|
|
69
63
|
/**
|
|
@@ -111,32 +105,27 @@ export type ScanOptions = {
|
|
|
111
105
|
* Gets info about the each file: it is ignored or not.
|
|
112
106
|
* @param directoryPath The relative path to the directory.
|
|
113
107
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
114
|
-
* @public
|
|
115
108
|
*/
|
|
116
109
|
export declare function scan(directoryPath: string, options?: ScanOptions): Promise<FileInfo[]>;
|
|
117
110
|
/**
|
|
118
111
|
* Gets info about the each file: it is ignored or not.
|
|
119
112
|
* @param directory The current working directory.
|
|
120
113
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
121
|
-
* @public
|
|
122
114
|
*/
|
|
123
115
|
export declare function scan(directory: Directory, options?: ScanOptions): Promise<FileInfo[]>;
|
|
124
116
|
/**
|
|
125
117
|
* Gets info about the each file: it is ignored or not.
|
|
126
118
|
* @param stream The stream of the current working directory reading.
|
|
127
119
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
128
|
-
* @public
|
|
129
120
|
*/
|
|
130
121
|
export declare function scan(stream: DeepStreamEventEmitter, options?: ScanOptions): Promise<FileInfo[]>;
|
|
131
122
|
/**
|
|
132
123
|
* Gets info about the each file: it is ignored or not.
|
|
133
124
|
* @param pathList The list of relative paths. The should be relative to the current working directory.
|
|
134
125
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
135
|
-
* @public
|
|
136
126
|
*/
|
|
137
127
|
export declare function scan(pathList: string[], options?: ScanOptions): Promise<FileInfo[]>;
|
|
138
128
|
/**
|
|
139
129
|
* @returns Options with defaults and additional properties.
|
|
140
|
-
* @public
|
|
141
130
|
*/
|
|
142
131
|
export declare function makeOptionsReal(options?: ScanOptions): RealScanOptions;
|
|
@@ -16,9 +16,7 @@ export * as Sorting from './sorting.js';
|
|
|
16
16
|
export * as Plugins from './binds/index.js';
|
|
17
17
|
/**
|
|
18
18
|
* ViewIgnored's package.json.
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
19
|
+
*/
|
|
22
20
|
export const package_ = createRequire(import.meta.url)('../../package.json');
|
|
23
21
|
export async function scan(argument0, options) {
|
|
24
22
|
options ??= {};
|
|
@@ -69,7 +67,6 @@ export async function scan(argument0, options) {
|
|
|
69
67
|
}
|
|
70
68
|
/**
|
|
71
69
|
* @returns Options with defaults and additional properties.
|
|
72
|
-
* @public
|
|
73
70
|
*/
|
|
74
71
|
export function makeOptionsReal(options) {
|
|
75
72
|
options ??= {};
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contains all file sort names.
|
|
3
|
-
* @public
|
|
4
3
|
*/
|
|
5
4
|
export declare const sortNameList: readonly ["firstFolders", "firstFiles", "type", "mixed", "modified"];
|
|
6
5
|
/**
|
|
7
6
|
* Contains all file sort names as a type.
|
|
8
|
-
* @public
|
|
9
7
|
*/
|
|
10
8
|
export type SortName = typeof sortNameList[number];
|
|
11
9
|
/**
|
|
12
10
|
* {@link Array.prototype.sort}'s file path comparator.
|
|
13
|
-
* @public
|
|
14
11
|
*/
|
|
15
12
|
export type SortFunction = (a: string, b: string) => number;
|
|
16
13
|
/**
|
|
17
14
|
* Checks if the value is the {@link SortName}.
|
|
18
|
-
* @public
|
|
19
15
|
*/
|
|
20
16
|
export declare function isSortName(value: unknown): value is SortName;
|
|
21
17
|
/**
|
|
22
|
-
* @public
|
|
23
18
|
* @example
|
|
24
19
|
* "path/to/the/file" -> ["path", "to/the/file", false]
|
|
25
20
|
* "file" -> ["file", "file", true]
|
|
@@ -29,20 +24,17 @@ export declare function shiftPath(p: string): [next: string, other: string, isLa
|
|
|
29
24
|
/**
|
|
30
25
|
* Files and folders are sorted by their names.
|
|
31
26
|
* Folders are displayed before files.
|
|
32
|
-
* @public
|
|
33
27
|
*/
|
|
34
28
|
export declare function firstFolders(a: string, b: string): number;
|
|
35
29
|
/**
|
|
36
30
|
* Files and folders are sorted by their names.
|
|
37
31
|
* Files are displayed before folders.
|
|
38
|
-
* @public
|
|
39
32
|
*/
|
|
40
33
|
export declare function firstFiles(a: string, b: string): number;
|
|
41
34
|
/**
|
|
42
35
|
* Files and folders are sorted by last modified date in descending order.
|
|
43
36
|
* Folders are displayed before files.
|
|
44
37
|
* @see {@link makeMtimeCache}
|
|
45
|
-
* @public
|
|
46
38
|
*/
|
|
47
39
|
export declare function modified(a: string, b: string, map: Map<{
|
|
48
40
|
toString(): string;
|
|
@@ -50,12 +42,10 @@ export declare function modified(a: string, b: string, map: Map<{
|
|
|
50
42
|
/**
|
|
51
43
|
* Files and folders are grouped by extension type then sorted by thir names.
|
|
52
44
|
* Folders are displayed before files.
|
|
53
|
-
* @public
|
|
54
45
|
*/
|
|
55
46
|
export declare function type(a: string, b: string): number;
|
|
56
47
|
/**
|
|
57
48
|
* Files and folders are sorted by their names.
|
|
58
49
|
* Files are interwoven with folders.
|
|
59
|
-
* @public
|
|
60
50
|
*/
|
|
61
51
|
export declare function mixed(a: string, b: string): number;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
/**
|
|
3
3
|
* Contains all file sort names.
|
|
4
|
-
* @public
|
|
5
4
|
*/
|
|
6
5
|
export const sortNameList = ['firstFolders', 'firstFiles', 'type', 'mixed', 'modified'];
|
|
7
6
|
/**
|
|
8
7
|
* Checks if the value is the {@link SortName}.
|
|
9
|
-
* @public
|
|
10
8
|
*/
|
|
11
9
|
export function isSortName(value) {
|
|
12
10
|
return typeof value === 'string' && sortNameList.includes(value);
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
15
|
-
* @public
|
|
16
13
|
* @example
|
|
17
14
|
* "path/to/the/file" -> ["path", "to/the/file", false]
|
|
18
15
|
* "file" -> ["file", "file", true]
|
|
@@ -28,7 +25,6 @@ export function shiftPath(p) {
|
|
|
28
25
|
/**
|
|
29
26
|
* Files and folders are sorted by their names.
|
|
30
27
|
* Folders are displayed before files.
|
|
31
|
-
* @public
|
|
32
28
|
*/
|
|
33
29
|
export function firstFolders(a, b) {
|
|
34
30
|
let comp = 0;
|
|
@@ -53,7 +49,6 @@ export function firstFolders(a, b) {
|
|
|
53
49
|
/**
|
|
54
50
|
* Files and folders are sorted by their names.
|
|
55
51
|
* Files are displayed before folders.
|
|
56
|
-
* @public
|
|
57
52
|
*/
|
|
58
53
|
export function firstFiles(a, b) {
|
|
59
54
|
let comp = 0;
|
|
@@ -79,7 +74,6 @@ export function firstFiles(a, b) {
|
|
|
79
74
|
* Files and folders are sorted by last modified date in descending order.
|
|
80
75
|
* Folders are displayed before files.
|
|
81
76
|
* @see {@link makeMtimeCache}
|
|
82
|
-
* @public
|
|
83
77
|
*/
|
|
84
78
|
export function modified(a, b, map) {
|
|
85
79
|
let comp = 0;
|
|
@@ -104,7 +98,6 @@ export function modified(a, b, map) {
|
|
|
104
98
|
/**
|
|
105
99
|
* Files and folders are grouped by extension type then sorted by thir names.
|
|
106
100
|
* Folders are displayed before files.
|
|
107
|
-
* @public
|
|
108
101
|
*/
|
|
109
102
|
export function type(a, b) {
|
|
110
103
|
let comp = 0;
|
|
@@ -131,7 +124,6 @@ export function type(a, b) {
|
|
|
131
124
|
/**
|
|
132
125
|
* Files and folders are sorted by their names.
|
|
133
126
|
* Files are interwoven with folders.
|
|
134
|
-
* @public
|
|
135
127
|
*/
|
|
136
128
|
export function mixed(a, b) {
|
|
137
129
|
return a.localeCompare(b, undefined, { ignorePunctuation: false });
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { type ChalkInstance } from 'chalk';
|
|
2
2
|
import { type Options } from 'boxen';
|
|
3
3
|
import { type FileInfo } from '../index.js';
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
4
|
export type FormatFilesOptions = {
|
|
8
5
|
/**
|
|
9
6
|
* On posix systems, this has no effect. But, on Windows, it means that
|
|
@@ -33,42 +30,34 @@ export type FormatFilesOptions = {
|
|
|
33
30
|
};
|
|
34
31
|
/**
|
|
35
32
|
* @returns Prints a readable file list. Here is '\n' ending.
|
|
36
|
-
* @public
|
|
37
33
|
*/
|
|
38
34
|
export declare function formatFiles(files: FileInfo[], options: FormatFilesOptions): string;
|
|
39
35
|
/**
|
|
40
36
|
* Contains all style names.
|
|
41
|
-
* @public
|
|
42
37
|
*/
|
|
43
38
|
export declare const styleNameList: readonly ["tree", "paths"];
|
|
44
39
|
/**
|
|
45
40
|
* Contains all style names as a type.
|
|
46
|
-
* @public
|
|
47
41
|
*/
|
|
48
42
|
export type StyleName = typeof styleNameList[number];
|
|
49
43
|
/**
|
|
50
44
|
* Checks if the value is the {@link StyleName}.
|
|
51
|
-
* @public
|
|
52
45
|
*/
|
|
53
46
|
export declare function isStyleName(value: unknown): value is StyleName;
|
|
54
47
|
/**
|
|
55
48
|
* Contains all decor names.
|
|
56
|
-
* @public
|
|
57
49
|
*/
|
|
58
50
|
export declare const decorNameList: readonly ["normal", "emoji", "nerdfonts"];
|
|
59
51
|
/**
|
|
60
52
|
* Contains all decor names as a type.
|
|
61
|
-
* @public
|
|
62
53
|
*/
|
|
63
54
|
export type DecorName = typeof decorNameList[number];
|
|
64
55
|
/**
|
|
65
56
|
* Checks if the value is the {@link DecorName}.
|
|
66
|
-
* @public
|
|
67
57
|
*/
|
|
68
58
|
export declare function isDecorName(value: unknown): value is DecorName;
|
|
69
59
|
/**
|
|
70
60
|
* Formatting options for the {@link decorCondition}.
|
|
71
|
-
* @public
|
|
72
61
|
*/
|
|
73
62
|
export type DecorConditionOptions = {
|
|
74
63
|
/**
|
|
@@ -99,18 +88,15 @@ export type DecorConditionOptions = {
|
|
|
99
88
|
* Formats the string for specific style types.
|
|
100
89
|
* @param decor The decor name.
|
|
101
90
|
* @param condition Formatting options.
|
|
102
|
-
* @public
|
|
103
91
|
*/
|
|
104
92
|
export declare function decorCondition(decor: DecorName, condition: DecorConditionOptions): string;
|
|
105
93
|
/**
|
|
106
94
|
* @see {@link boxError}
|
|
107
|
-
* @public
|
|
108
95
|
*/
|
|
109
96
|
export type BoxOptions = {
|
|
110
97
|
noColor?: boolean;
|
|
111
98
|
} & Options;
|
|
112
99
|
/**
|
|
113
100
|
* Make a message in a red box. Or without color.
|
|
114
|
-
* @public
|
|
115
101
|
*/
|
|
116
102
|
export declare function boxError(message: string, options?: BoxOptions): string;
|
|
@@ -5,7 +5,6 @@ import jsonifyPaths from 'jsonify-paths';
|
|
|
5
5
|
import boxen from 'boxen';
|
|
6
6
|
/**
|
|
7
7
|
* @returns Prints a readable file list. Here is '\n' ending.
|
|
8
|
-
* @public
|
|
9
8
|
*/
|
|
10
9
|
export function formatFiles(files, options) {
|
|
11
10
|
const { showSources = false, chalk, decor = 'normal', style, posix = false } = options ?? {};
|
|
@@ -24,24 +23,20 @@ export function formatFiles(files, options) {
|
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* Contains all style names.
|
|
27
|
-
* @public
|
|
28
26
|
*/
|
|
29
27
|
export const styleNameList = ['tree', 'paths'];
|
|
30
28
|
/**
|
|
31
29
|
* Checks if the value is the {@link StyleName}.
|
|
32
|
-
* @public
|
|
33
30
|
*/
|
|
34
31
|
export function isStyleName(value) {
|
|
35
32
|
return typeof value === 'string' && styleNameList.includes(value);
|
|
36
33
|
}
|
|
37
34
|
/**
|
|
38
35
|
* Contains all decor names.
|
|
39
|
-
* @public
|
|
40
36
|
*/
|
|
41
37
|
export const decorNameList = ['normal', 'emoji', 'nerdfonts'];
|
|
42
38
|
/**
|
|
43
39
|
* Checks if the value is the {@link DecorName}.
|
|
44
|
-
* @public
|
|
45
40
|
*/
|
|
46
41
|
export function isDecorName(value) {
|
|
47
42
|
return typeof value === 'string' && decorNameList.includes(value);
|
|
@@ -50,7 +45,6 @@ export function isDecorName(value) {
|
|
|
50
45
|
* Formats the string for specific style types.
|
|
51
46
|
* @param decor The decor name.
|
|
52
47
|
* @param condition Formatting options.
|
|
53
|
-
* @public
|
|
54
48
|
*/
|
|
55
49
|
export function decorCondition(decor, condition) {
|
|
56
50
|
let result = condition.ifNormal ?? '';
|
|
@@ -67,7 +61,6 @@ export function decorCondition(decor, condition) {
|
|
|
67
61
|
}
|
|
68
62
|
/**
|
|
69
63
|
* Make a message in a red box. Or without color.
|
|
70
|
-
* @public
|
|
71
64
|
*/
|
|
72
65
|
export function boxError(message, options) {
|
|
73
66
|
let result = ('\n' + boxen(message, {
|
|
@@ -2,20 +2,9 @@ import { Argument, Option, Command } from 'commander';
|
|
|
2
2
|
import * as Config from './config.js';
|
|
3
3
|
import { type DecorName, type StyleName } from './browser/styling.js';
|
|
4
4
|
import { type SortName } from './browser/sorting.js';
|
|
5
|
-
import { type BoxOptions } from './styling.js';
|
|
6
5
|
import { type FilterName } from './browser/filtering.js';
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
export declare function logError(message: string, options?: BoxOptions): void;
|
|
11
|
-
/**
|
|
12
|
-
* Use it instead of {@link program.parse}.
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
export declare function programInit(): Promise<void>;
|
|
16
6
|
/**
|
|
17
7
|
* Command-line entire program flags.
|
|
18
|
-
* @public
|
|
19
8
|
*/
|
|
20
9
|
export type ProgramFlags = {
|
|
21
10
|
posix: boolean;
|
|
@@ -26,7 +15,6 @@ export type ProgramFlags = {
|
|
|
26
15
|
};
|
|
27
16
|
/**
|
|
28
17
|
* Command-line 'scan' command flags.
|
|
29
|
-
* @public
|
|
30
18
|
*/
|
|
31
19
|
export type ScanFlags = {
|
|
32
20
|
target: string;
|
|
@@ -39,7 +27,6 @@ export type ScanFlags = {
|
|
|
39
27
|
};
|
|
40
28
|
/**
|
|
41
29
|
* Command-line 'cfg get' command flags.
|
|
42
|
-
* @public
|
|
43
30
|
*/
|
|
44
31
|
export type ConfigGetFlags = {
|
|
45
32
|
real: boolean;
|
|
@@ -47,85 +34,51 @@ export type ConfigGetFlags = {
|
|
|
47
34
|
};
|
|
48
35
|
/**
|
|
49
36
|
* `view-ignored` command-line programl
|
|
50
|
-
* @public
|
|
51
37
|
*/
|
|
52
38
|
export declare const program: Command;
|
|
53
39
|
/**
|
|
54
40
|
* Command-line 'scan' command.
|
|
55
|
-
* @public
|
|
56
41
|
*/
|
|
57
42
|
export declare const scanProgram: Command;
|
|
58
43
|
/**
|
|
59
44
|
* Command-line 'config' command.
|
|
60
|
-
* @public
|
|
61
45
|
*/
|
|
62
46
|
export declare const cfgProgram: Command;
|
|
63
47
|
/**
|
|
64
48
|
* Command-line argument: key=value pair.
|
|
65
49
|
* @see {@link parseArgumentKeyValue}
|
|
66
|
-
* @public
|
|
67
50
|
*/
|
|
68
51
|
export declare const argumentConfigKeyValue: Argument;
|
|
69
52
|
/**
|
|
70
53
|
* Command-line argument: config property.
|
|
71
54
|
* @see {@link Config.configKeyList}
|
|
72
|
-
* @public
|
|
73
55
|
*/
|
|
74
56
|
export declare const argumentConfigKey: Argument;
|
|
75
|
-
/**
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
57
|
export declare const cfgRealOption: Option;
|
|
79
|
-
/**
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
58
|
export declare const cfgTypesOption: Option;
|
|
83
|
-
/**
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
59
|
export declare function parseArgumentArrayString(argument: string): string[];
|
|
87
|
-
/**
|
|
88
|
-
* @public
|
|
89
|
-
*/
|
|
90
60
|
export declare function parseArgumentBoolean(argument: string): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
61
|
export declare function parseArgumentInteger(argument: string): number;
|
|
95
|
-
/**
|
|
96
|
-
* @public
|
|
97
|
-
*/
|
|
98
62
|
export declare function createArgumentParserStringLiteral(choices: string[]): (argument: string) => string;
|
|
99
|
-
/**
|
|
100
|
-
* @public
|
|
101
|
-
*/
|
|
102
63
|
export declare function parseArgumentKey(key: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
64
|
export declare function parseArgumentKeyValue(pair: string): Config.ConfigPair;
|
|
107
65
|
/**
|
|
108
66
|
* Command-line 'scan' command action.
|
|
109
|
-
* @public
|
|
110
67
|
*/
|
|
111
68
|
export declare function actionScan(): Promise<void>;
|
|
112
69
|
/**
|
|
113
70
|
* Command-line 'config path' command action.
|
|
114
|
-
* @public
|
|
115
71
|
*/
|
|
116
72
|
export declare function actionCfgPath(): void;
|
|
117
73
|
/**
|
|
118
74
|
* Command-line 'config set' command action
|
|
119
|
-
* @public
|
|
120
75
|
*/
|
|
121
76
|
export declare function actionCfgSet(pair: Config.ConfigPair | undefined, options: ConfigGetFlags): void;
|
|
122
77
|
/**
|
|
123
78
|
* Command-line 'config unset' command action
|
|
124
|
-
* @public
|
|
125
79
|
*/
|
|
126
80
|
export declare function actionCfgUnset(key: Config.ConfigKey | undefined, options: ConfigGetFlags): void;
|
|
127
81
|
/**
|
|
128
82
|
* Command-line 'config unset' command action
|
|
129
|
-
* @public
|
|
130
83
|
*/
|
|
131
84
|
export declare function actionCfgGet(key: Config.ConfigKey | undefined, options: ConfigGetFlags): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable unicorn/no-process-exit */
|
|
2
1
|
import { format } from 'node:util';
|
|
3
2
|
import * as process from 'node:process';
|
|
4
3
|
import { icons } from '@m234/nerd-fonts';
|
|
@@ -13,14 +12,14 @@ import { boxError, decorNameList, highlight, stringTime, styleNameList, } from '
|
|
|
13
12
|
import { Directory, package_, makeOptionsReal, scan, Sorting, ViewIgnoredError, } from './lib.js';
|
|
14
13
|
import { filterNameList } from './browser/filtering.js';
|
|
15
14
|
/**
|
|
16
|
-
* @
|
|
15
|
+
* @internal
|
|
17
16
|
*/
|
|
18
17
|
export function logError(message, options) {
|
|
19
18
|
console.log(boxError(message, { ...options }));
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* Use it instead of {@link program.parse}.
|
|
23
|
-
* @
|
|
22
|
+
* @internal
|
|
24
23
|
*/
|
|
25
24
|
export async function programInit() {
|
|
26
25
|
try {
|
|
@@ -88,12 +87,10 @@ export async function programInit() {
|
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
89
|
* `view-ignored` command-line programl
|
|
91
|
-
* @public
|
|
92
90
|
*/
|
|
93
91
|
export const program = new Command();
|
|
94
92
|
/**
|
|
95
93
|
* Command-line 'scan' command.
|
|
96
|
-
* @public
|
|
97
94
|
*/
|
|
98
95
|
export const scanProgram = program
|
|
99
96
|
.command('scan')
|
|
@@ -102,7 +99,6 @@ export const scanProgram = program
|
|
|
102
99
|
.action(actionScan);
|
|
103
100
|
/**
|
|
104
101
|
* Command-line 'config' command.
|
|
105
|
-
* @public
|
|
106
102
|
*/
|
|
107
103
|
export const cfgProgram = program
|
|
108
104
|
.command('config')
|
|
@@ -111,22 +107,14 @@ export const cfgProgram = program
|
|
|
111
107
|
/**
|
|
112
108
|
* Command-line argument: key=value pair.
|
|
113
109
|
* @see {@link parseArgumentKeyValue}
|
|
114
|
-
* @public
|
|
115
110
|
*/
|
|
116
111
|
export const argumentConfigKeyValue = new Argument('[pair]', 'the configuration entry key=value\'').argParser(parseArgumentKeyValue);
|
|
117
112
|
/**
|
|
118
113
|
* Command-line argument: config property.
|
|
119
114
|
* @see {@link Config.configKeyList}
|
|
120
|
-
* @public
|
|
121
115
|
*/
|
|
122
116
|
export const argumentConfigKey = new Argument('[key]', 'the configuration setting name').choices(Config.configKeyList);
|
|
123
|
-
/**
|
|
124
|
-
* @public
|
|
125
|
-
*/
|
|
126
117
|
export const cfgRealOption = new Option('--real', 'use default value(s) as fallback').default(false);
|
|
127
|
-
/**
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
118
|
export const cfgTypesOption = new Option('--types', 'use default value(s) as fallback').default(false);
|
|
131
119
|
cfgProgram
|
|
132
120
|
.command('path').description('print the config file path')
|
|
@@ -149,15 +137,9 @@ cfgProgram
|
|
|
149
137
|
.addOption(cfgTypesOption)
|
|
150
138
|
.addArgument(argumentConfigKey)
|
|
151
139
|
.action(actionCfgGet);
|
|
152
|
-
/**
|
|
153
|
-
* @public
|
|
154
|
-
*/
|
|
155
140
|
export function parseArgumentArrayString(argument) {
|
|
156
141
|
return argument.split(/[ ,|]/).filter(Boolean);
|
|
157
142
|
}
|
|
158
|
-
/**
|
|
159
|
-
* @public
|
|
160
|
-
*/
|
|
161
143
|
export function parseArgumentBoolean(argument) {
|
|
162
144
|
const errorMessage = Config.configValueSwitch()(argument);
|
|
163
145
|
if (errorMessage !== undefined) {
|
|
@@ -165,9 +147,6 @@ export function parseArgumentBoolean(argument) {
|
|
|
165
147
|
}
|
|
166
148
|
return Config.switchTrueValues.includes(argument);
|
|
167
149
|
}
|
|
168
|
-
/**
|
|
169
|
-
* @public
|
|
170
|
-
*/
|
|
171
150
|
export function parseArgumentInteger(argument) {
|
|
172
151
|
const value = Number.parseInt(argument, 10);
|
|
173
152
|
const errorMessage = Config.configValueInteger()(value);
|
|
@@ -176,9 +155,6 @@ export function parseArgumentInteger(argument) {
|
|
|
176
155
|
}
|
|
177
156
|
return value;
|
|
178
157
|
}
|
|
179
|
-
/**
|
|
180
|
-
* @public
|
|
181
|
-
*/
|
|
182
158
|
export function createArgumentParserStringLiteral(choices) {
|
|
183
159
|
return function (argument) {
|
|
184
160
|
const errorMessage = Config.configValueLiteral(choices)(argument);
|
|
@@ -188,9 +164,6 @@ export function createArgumentParserStringLiteral(choices) {
|
|
|
188
164
|
return argument;
|
|
189
165
|
};
|
|
190
166
|
}
|
|
191
|
-
/**
|
|
192
|
-
* @public
|
|
193
|
-
*/
|
|
194
167
|
export function parseArgumentKey(key) {
|
|
195
168
|
const errorMessage = Config.configManager.checkKey(key);
|
|
196
169
|
if (errorMessage !== undefined) {
|
|
@@ -198,9 +171,6 @@ export function parseArgumentKey(key) {
|
|
|
198
171
|
}
|
|
199
172
|
return key;
|
|
200
173
|
}
|
|
201
|
-
/**
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
174
|
export function parseArgumentKeyValue(pair) {
|
|
205
175
|
const result = pair.split('=');
|
|
206
176
|
if (result.length > 2) {
|
|
@@ -224,7 +194,6 @@ export function parseArgumentKeyValue(pair) {
|
|
|
224
194
|
}
|
|
225
195
|
/**
|
|
226
196
|
* Command-line 'scan' command action.
|
|
227
|
-
* @public
|
|
228
197
|
*/
|
|
229
198
|
export async function actionScan() {
|
|
230
199
|
const flags = scanProgram.optsWithGlobals();
|
|
@@ -350,14 +319,12 @@ export async function actionScan() {
|
|
|
350
319
|
}
|
|
351
320
|
/**
|
|
352
321
|
* Command-line 'config path' command action.
|
|
353
|
-
* @public
|
|
354
322
|
*/
|
|
355
323
|
export function actionCfgPath() {
|
|
356
324
|
console.log(Config.configManager.path);
|
|
357
325
|
}
|
|
358
326
|
/**
|
|
359
327
|
* Command-line 'config set' command action
|
|
360
|
-
* @public
|
|
361
328
|
*/
|
|
362
329
|
export function actionCfgSet(pair, options) {
|
|
363
330
|
if (pair === undefined) {
|
|
@@ -379,7 +346,6 @@ export function actionCfgSet(pair, options) {
|
|
|
379
346
|
}
|
|
380
347
|
/**
|
|
381
348
|
* Command-line 'config unset' command action
|
|
382
|
-
* @public
|
|
383
349
|
*/
|
|
384
350
|
export function actionCfgUnset(key, options) {
|
|
385
351
|
if (key === undefined) {
|
|
@@ -394,7 +360,6 @@ export function actionCfgUnset(key, options) {
|
|
|
394
360
|
}
|
|
395
361
|
/**
|
|
396
362
|
* Command-line 'config unset' command action
|
|
397
|
-
* @public
|
|
398
363
|
*/
|
|
399
364
|
export function actionCfgGet(key, options) {
|
|
400
365
|
const flags = scanProgram.optsWithGlobals();
|