view-ignored 0.3.2 → 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/LICENSE.txt +21 -21
- package/README.md +95 -95
- package/bin/viewig +1 -1
- package/out/{src/browser → browser}/binds/index.d.ts +0 -19
- package/out/{src/browser → browser}/binds/index.js +2 -9
- package/out/browser/binds/plugins/git.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/git.js +7 -7
- package/out/browser/binds/plugins/npm.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/npm.js +8 -8
- package/out/browser/binds/plugins/vsce.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/vsce.js +5 -5
- package/out/browser/binds/plugins/yarn.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/yarn.js +3 -4
- package/out/{src/browser → browser}/binds/scanner.d.ts +0 -12
- package/out/{src/browser → browser}/binds/scanner.js +1 -7
- package/out/{src/browser → browser}/binds/targets.d.ts +2 -13
- package/out/{src/browser → browser}/binds/targets.js +2 -7
- 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 +3 -56
- package/out/{src/browser → browser}/fs/directory.js +3 -6
- package/out/{src/browser → browser}/fs/file-info.d.ts +0 -5
- package/out/{src/browser → browser}/fs/file-info.js +13 -10
- 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 +2 -5
- 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} +13 -45
- package/out/{src/config.d.ts → config.d.ts} +0 -57
- package/out/{src/config.js → config.js} +23 -50
- 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 +39 -47
- 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
|
@@ -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 {
|
|
@@ -31,7 +30,7 @@ export async function programInit() {
|
|
|
31
30
|
const loadResultConfig = configManager.load();
|
|
32
31
|
const builtInPlugins = await loadBuiltIns();
|
|
33
32
|
const configPlugins = configManager.get('plugins');
|
|
34
|
-
const loadResultPlugins = (flags.plugins ? await loadPlugins(flags.plugins) : [])
|
|
33
|
+
const loadResultPlugins = [...(flags.plugins ? await loadPlugins(flags.plugins) : []), ...builtInPlugins];
|
|
35
34
|
for (const loadResult of loadResultPlugins) {
|
|
36
35
|
if (loadResult.isLoaded) {
|
|
37
36
|
continue;
|
|
@@ -48,9 +47,9 @@ export async function programInit() {
|
|
|
48
47
|
configManager.keySetValidator('target', configDefault.target, configValueLiteral(targets));
|
|
49
48
|
{
|
|
50
49
|
const title = 'view-ignored - Configuration loading failed.';
|
|
51
|
-
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].
|
|
50
|
+
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].value, postfix: ' ' });
|
|
52
51
|
const errorIcon = decorCondition(flags.decor, {
|
|
53
|
-
ifNerd: icons['nf-seti-error'].
|
|
52
|
+
ifNerd: icons['nf-seti-error'].value, ifEmoji: '⚠️', postfix: ' ',
|
|
54
53
|
});
|
|
55
54
|
const footer = `\n\n${chalk.blue(infoSymbol)}Configuration path: ${Config.configManager.path}`;
|
|
56
55
|
if (typeof loadResultConfig === 'string') {
|
|
@@ -58,7 +57,10 @@ export async function programInit() {
|
|
|
58
57
|
process.exit(1);
|
|
59
58
|
}
|
|
60
59
|
if (loadResultConfig && loadResultConfig?.size > 0) {
|
|
61
|
-
const propertiesErrors =
|
|
60
|
+
const propertiesErrors = [...loadResultConfig.entries()].map(([key, message]) => {
|
|
61
|
+
const pair = Config.configManager.getPairString(key, { chalk, types: false, real: true });
|
|
62
|
+
return `${pair} - ${chalk.red(errorIcon)}${message}`;
|
|
63
|
+
}).join('\n');
|
|
62
64
|
logError(`Invalid properties:\n${propertiesErrors}${footer}`, { title });
|
|
63
65
|
process.exit(1);
|
|
64
66
|
}
|
|
@@ -85,12 +87,10 @@ export async function programInit() {
|
|
|
85
87
|
}
|
|
86
88
|
/**
|
|
87
89
|
* `view-ignored` command-line programl
|
|
88
|
-
* @public
|
|
89
90
|
*/
|
|
90
91
|
export const program = new Command();
|
|
91
92
|
/**
|
|
92
93
|
* Command-line 'scan' command.
|
|
93
|
-
* @public
|
|
94
94
|
*/
|
|
95
95
|
export const scanProgram = program
|
|
96
96
|
.command('scan')
|
|
@@ -99,7 +99,6 @@ export const scanProgram = program
|
|
|
99
99
|
.action(actionScan);
|
|
100
100
|
/**
|
|
101
101
|
* Command-line 'config' command.
|
|
102
|
-
* @public
|
|
103
102
|
*/
|
|
104
103
|
export const cfgProgram = program
|
|
105
104
|
.command('config')
|
|
@@ -108,22 +107,14 @@ export const cfgProgram = program
|
|
|
108
107
|
/**
|
|
109
108
|
* Command-line argument: key=value pair.
|
|
110
109
|
* @see {@link parseArgumentKeyValue}
|
|
111
|
-
* @public
|
|
112
110
|
*/
|
|
113
111
|
export const argumentConfigKeyValue = new Argument('[pair]', 'the configuration entry key=value\'').argParser(parseArgumentKeyValue);
|
|
114
112
|
/**
|
|
115
113
|
* Command-line argument: config property.
|
|
116
114
|
* @see {@link Config.configKeyList}
|
|
117
|
-
* @public
|
|
118
115
|
*/
|
|
119
116
|
export const argumentConfigKey = new Argument('[key]', 'the configuration setting name').choices(Config.configKeyList);
|
|
120
|
-
/**
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
117
|
export const cfgRealOption = new Option('--real', 'use default value(s) as fallback').default(false);
|
|
124
|
-
/**
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
118
|
export const cfgTypesOption = new Option('--types', 'use default value(s) as fallback').default(false);
|
|
128
119
|
cfgProgram
|
|
129
120
|
.command('path').description('print the config file path')
|
|
@@ -146,15 +137,9 @@ cfgProgram
|
|
|
146
137
|
.addOption(cfgTypesOption)
|
|
147
138
|
.addArgument(argumentConfigKey)
|
|
148
139
|
.action(actionCfgGet);
|
|
149
|
-
/**
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
140
|
export function parseArgumentArrayString(argument) {
|
|
153
141
|
return argument.split(/[ ,|]/).filter(Boolean);
|
|
154
142
|
}
|
|
155
|
-
/**
|
|
156
|
-
* @public
|
|
157
|
-
*/
|
|
158
143
|
export function parseArgumentBoolean(argument) {
|
|
159
144
|
const errorMessage = Config.configValueSwitch()(argument);
|
|
160
145
|
if (errorMessage !== undefined) {
|
|
@@ -162,9 +147,6 @@ export function parseArgumentBoolean(argument) {
|
|
|
162
147
|
}
|
|
163
148
|
return Config.switchTrueValues.includes(argument);
|
|
164
149
|
}
|
|
165
|
-
/**
|
|
166
|
-
* @public
|
|
167
|
-
*/
|
|
168
150
|
export function parseArgumentInteger(argument) {
|
|
169
151
|
const value = Number.parseInt(argument, 10);
|
|
170
152
|
const errorMessage = Config.configValueInteger()(value);
|
|
@@ -173,9 +155,6 @@ export function parseArgumentInteger(argument) {
|
|
|
173
155
|
}
|
|
174
156
|
return value;
|
|
175
157
|
}
|
|
176
|
-
/**
|
|
177
|
-
* @public
|
|
178
|
-
*/
|
|
179
158
|
export function createArgumentParserStringLiteral(choices) {
|
|
180
159
|
return function (argument) {
|
|
181
160
|
const errorMessage = Config.configValueLiteral(choices)(argument);
|
|
@@ -185,9 +164,6 @@ export function createArgumentParserStringLiteral(choices) {
|
|
|
185
164
|
return argument;
|
|
186
165
|
};
|
|
187
166
|
}
|
|
188
|
-
/**
|
|
189
|
-
* @public
|
|
190
|
-
*/
|
|
191
167
|
export function parseArgumentKey(key) {
|
|
192
168
|
const errorMessage = Config.configManager.checkKey(key);
|
|
193
169
|
if (errorMessage !== undefined) {
|
|
@@ -195,9 +171,6 @@ export function parseArgumentKey(key) {
|
|
|
195
171
|
}
|
|
196
172
|
return key;
|
|
197
173
|
}
|
|
198
|
-
/**
|
|
199
|
-
* @public
|
|
200
|
-
*/
|
|
201
174
|
export function parseArgumentKeyValue(pair) {
|
|
202
175
|
const result = pair.split('=');
|
|
203
176
|
if (result.length > 2) {
|
|
@@ -221,7 +194,6 @@ export function parseArgumentKeyValue(pair) {
|
|
|
221
194
|
}
|
|
222
195
|
/**
|
|
223
196
|
* Command-line 'scan' command action.
|
|
224
|
-
* @public
|
|
225
197
|
*/
|
|
226
198
|
export async function actionScan() {
|
|
227
199
|
const flags = scanProgram.optsWithGlobals();
|
|
@@ -249,9 +221,9 @@ export async function actionScan() {
|
|
|
249
221
|
console.log(fileInfoList.map(fileInfo => fileInfo.relativePath + (flags.showSources && fileInfo.source !== undefined ? '<' + (fileInfo.source.relativePath) : '')).join(','));
|
|
250
222
|
}
|
|
251
223
|
else {
|
|
252
|
-
let name = decorCondition(flags.decor, { ifNerd: bind.icon?.
|
|
224
|
+
let name = decorCondition(flags.decor, { ifNerd: bind.icon?.value, postfix: ' ' }) + bind.name;
|
|
253
225
|
if (bind.icon?.color !== undefined) {
|
|
254
|
-
name = chalk.hex('#' + bind.icon.color
|
|
226
|
+
name = chalk.hex('#' + bind.icon.color)(name);
|
|
255
227
|
}
|
|
256
228
|
const context = {
|
|
257
229
|
count: {
|
|
@@ -307,8 +279,8 @@ export async function actionScan() {
|
|
|
307
279
|
decor: flags.decor,
|
|
308
280
|
showSources: flags.showSources,
|
|
309
281
|
});
|
|
310
|
-
const fastSymbol = decorCondition(flags.decor, { ifEmoji: '⚡', ifNerd: icons['nf-md-lightning_bolt'].
|
|
311
|
-
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].
|
|
282
|
+
const fastSymbol = decorCondition(flags.decor, { ifEmoji: '⚡', ifNerd: icons['nf-md-lightning_bolt'].value });
|
|
283
|
+
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].value, postfix: ' ' });
|
|
312
284
|
let message = '';
|
|
313
285
|
message += files;
|
|
314
286
|
message += '\n';
|
|
@@ -347,14 +319,12 @@ export async function actionScan() {
|
|
|
347
319
|
}
|
|
348
320
|
/**
|
|
349
321
|
* Command-line 'config path' command action.
|
|
350
|
-
* @public
|
|
351
322
|
*/
|
|
352
323
|
export function actionCfgPath() {
|
|
353
324
|
console.log(Config.configManager.path);
|
|
354
325
|
}
|
|
355
326
|
/**
|
|
356
327
|
* Command-line 'config set' command action
|
|
357
|
-
* @public
|
|
358
328
|
*/
|
|
359
329
|
export function actionCfgSet(pair, options) {
|
|
360
330
|
if (pair === undefined) {
|
|
@@ -376,7 +346,6 @@ export function actionCfgSet(pair, options) {
|
|
|
376
346
|
}
|
|
377
347
|
/**
|
|
378
348
|
* Command-line 'config unset' command action
|
|
379
|
-
* @public
|
|
380
349
|
*/
|
|
381
350
|
export function actionCfgUnset(key, options) {
|
|
382
351
|
if (key === undefined) {
|
|
@@ -391,7 +360,6 @@ export function actionCfgUnset(key, options) {
|
|
|
391
360
|
}
|
|
392
361
|
/**
|
|
393
362
|
* Command-line 'config unset' command action
|
|
394
|
-
* @public
|
|
395
363
|
*/
|
|
396
364
|
export function actionCfgGet(key, options) {
|
|
397
365
|
const flags = scanProgram.optsWithGlobals();
|
|
@@ -6,40 +6,26 @@ import { type SortName } from './browser/sorting.js';
|
|
|
6
6
|
import { type FilterName } from './browser/filtering.js';
|
|
7
7
|
/**
|
|
8
8
|
* The full config file name - `".view-ignored"`.
|
|
9
|
-
* @public
|
|
10
9
|
*/
|
|
11
10
|
export declare const configFileName = ".view-ignored";
|
|
12
11
|
/**
|
|
13
12
|
* Command-line configuration property list.
|
|
14
|
-
* @public
|
|
15
13
|
*/
|
|
16
14
|
export declare const configKeyList: readonly ["posix", "noColor", "target", "filter", "sort", "style", "decor", "depth", "showSources", "plugins", "parsable", "concurrency"];
|
|
17
15
|
/**
|
|
18
16
|
* Command-line configuration's property type.
|
|
19
|
-
* @public
|
|
20
17
|
*/
|
|
21
18
|
export type ConfigKey = typeof configKeyList[number] & keyof Config;
|
|
22
|
-
/**
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
19
|
export type ConfigValue<KeyT extends ConfigKey = ConfigKey> = Config[KeyT];
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
20
|
export type ShowSourcesType = boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
21
|
export declare function isShowSources(value: unknown): value is ShowSourcesType;
|
|
34
22
|
/**
|
|
35
23
|
* Represents array with the key nad the value.
|
|
36
|
-
* @public
|
|
37
24
|
*/
|
|
38
25
|
export type ConfigPair<KeyT extends ConfigKey = ConfigKey> = [key: KeyT, value: ConfigValue<KeyT>];
|
|
39
26
|
/**
|
|
40
27
|
* Command-line configuration structure.
|
|
41
28
|
* @see {@link configKeyList} Before adding new properties.
|
|
42
|
-
* @public
|
|
43
29
|
*/
|
|
44
30
|
export type Config = {
|
|
45
31
|
[key: string]: unknown;
|
|
@@ -58,63 +44,25 @@ export type Config = {
|
|
|
58
44
|
};
|
|
59
45
|
/**
|
|
60
46
|
* Command-line default config values.
|
|
61
|
-
* @public
|
|
62
47
|
*/
|
|
63
48
|
export declare const configDefault: Readonly<Config>;
|
|
64
49
|
/**
|
|
65
50
|
* @returns Error message and parsed value.
|
|
66
|
-
* @public
|
|
67
51
|
*/
|
|
68
52
|
export type ConfigValidator = ((value: unknown) => string | undefined) & {
|
|
69
53
|
typeName: string;
|
|
70
54
|
};
|
|
71
|
-
/**
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
55
|
export declare const configValueArray: <T extends ConfigValidator>(type?: T) => ConfigValidator;
|
|
75
|
-
/**
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
56
|
export declare const configValueLiteral: (choices: readonly unknown[]) => ConfigValidator;
|
|
79
|
-
/**
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
57
|
export declare const switchTrueValues: string[];
|
|
83
|
-
/**
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
58
|
export declare const switchFalseValues: string[];
|
|
87
|
-
/**
|
|
88
|
-
* @public
|
|
89
|
-
*/
|
|
90
59
|
export declare const booleanValues: string[];
|
|
91
|
-
/**
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
60
|
export declare const configValueSwitch: () => ConfigValidator;
|
|
95
|
-
/**
|
|
96
|
-
* @public
|
|
97
|
-
*/
|
|
98
61
|
export declare const configValueBoolean: () => ConfigValidator;
|
|
99
|
-
/**
|
|
100
|
-
* @public
|
|
101
|
-
*/
|
|
102
62
|
export declare const configValueObject: () => ConfigValidator;
|
|
103
|
-
/**
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
63
|
export declare const configValueString: () => ConfigValidator;
|
|
107
|
-
/**
|
|
108
|
-
* @public
|
|
109
|
-
*/
|
|
110
64
|
export declare const configValueNumber: () => ConfigValidator;
|
|
111
|
-
/**
|
|
112
|
-
* @public
|
|
113
|
-
*/
|
|
114
65
|
export declare const configValueInteger: () => ConfigValidator;
|
|
115
|
-
/**
|
|
116
|
-
* @public
|
|
117
|
-
*/
|
|
118
66
|
export type ConfigManagerGetOptions = {
|
|
119
67
|
/**
|
|
120
68
|
* Use default value as fallback.
|
|
@@ -122,9 +70,6 @@ export type ConfigManagerGetOptions = {
|
|
|
122
70
|
*/
|
|
123
71
|
real?: boolean;
|
|
124
72
|
};
|
|
125
|
-
/**
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
73
|
export type ConfigManagerGetPairStringOptions = ConfigManagerGetOptions & {
|
|
129
74
|
/**
|
|
130
75
|
* Add the type postfix.
|
|
@@ -144,7 +89,6 @@ export type ConfigManagerGetPairStringOptions = ConfigManagerGetOptions & {
|
|
|
144
89
|
};
|
|
145
90
|
/**
|
|
146
91
|
* File-specific actions container.
|
|
147
|
-
* @public
|
|
148
92
|
*/
|
|
149
93
|
export declare class ConfigManager<ConfigType extends Config = Config> {
|
|
150
94
|
readonly path: string;
|
|
@@ -234,6 +178,5 @@ export declare class ConfigManager<ConfigType extends Config = Config> {
|
|
|
234
178
|
}
|
|
235
179
|
/**
|
|
236
180
|
* File-specific actions container. Contains get, set, unset, save, load and other configuration actions.
|
|
237
|
-
* @public
|
|
238
181
|
*/
|
|
239
182
|
export declare const configManager: ConfigManager<Config>;
|