command-line-director 2.0.0-beta.3 → 2.0.0-beta.5

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/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+
2
+ # Change Log
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## v2.0.0-beta.5 - 2026-02-12
7
+ - update release notes [23d5f01]
8
+ - chore(release): 2.0.0-beta.5 [ea94cc4]
9
+ - changelog [f133e17]
10
+
11
+ ## v2.0.0-beta.4 - 2026-02-12
12
+ - add changelog generation [9685ac9]
13
+ - chore(release): 2.0.0-beta.4 [401a87d]
14
+
15
+ ## v2.0.0-beta.3 - 2026-01-03
16
+ - transform to typescript and add jest testing [75c2781]
17
+ - add code coverage [f39927f]
18
+ - add release [cf776ff]
19
+
20
+ ## 1.0.3 - 2025-12-01
21
+ - bump versions [56c70f8]
22
+ - version info [f4633f3]
23
+ - add lint to ci [48c03a2]
24
+
25
+ ## 1.0.2 - 2025-11-30
26
+ - fix vulnerabilities [00f2820]
27
+ - update versions [55ede63]
28
+ - update changelog [ce3bd48]
29
+
30
+ ## 1.0.0 - 2021-09-26
31
+ - initial commit [915845e]
32
+ - update documentation [f6b3030]
33
+ - first commit [7e4bc45]
@@ -0,0 +1,123 @@
1
+ declare class ArgumentLookup {
2
+ values: string[];
3
+ keyValues: Map<string, string | number | boolean | null>;
4
+ constructor();
5
+ }
6
+
7
+ declare enum CommandLineArgumentDataType {
8
+ Boolean = 0,
9
+ Number = 1,
10
+ String = 2
11
+ }
12
+
13
+ declare enum CommandLineArgumentType {
14
+ KeyValue = 0,
15
+ Value = 1
16
+ }
17
+
18
+ declare class CommandLineArgument<T extends string | number | boolean> {
19
+ propertyName: string;
20
+ required: boolean;
21
+ argumentName: string | null;
22
+ alias: string | null;
23
+ dataType: CommandLineArgumentDataType;
24
+ type: CommandLineArgumentType;
25
+ defaultValue: T | null;
26
+ allowedValues: T[] | null;
27
+ regularExpression: RegExp | null;
28
+ description: string | null;
29
+ constructor(propertyName: string, required: boolean, argumentName: string | null, alias: string | null, dataType: CommandLineArgumentDataType | null, type: CommandLineArgumentType, defaultValue: T | null, allowedValues: T[] | null, regularExpression?: RegExp | null, description?: string | null);
30
+ toString(): string;
31
+ }
32
+
33
+ declare class Command {
34
+ identifier: string;
35
+ commandLineArguments: Array<CommandLineArgument<string | number | boolean>>;
36
+ values: Map<string, string | number | boolean | null>;
37
+ constructor(identifier: string, commandLineArguments: Array<CommandLineArgument<string | number | boolean>>, values: Map<string, string | number | boolean | null>);
38
+ }
39
+
40
+ declare class CommandLine {
41
+ identifier: string;
42
+ title: string;
43
+ description: string;
44
+ commandLineArguments: CommandLineArgument<string | number | boolean>[];
45
+ /**
46
+ * CommandLine constructor
47
+ * @param identifier - string
48
+ * @param commandLineArguments - array
49
+ * @thows Error
50
+ */
51
+ constructor(identifier: string, title: string, description: string, commandLineArguments: CommandLineArgument<string | number | boolean>[]);
52
+ /**
53
+ * Create lookup table for process arguments
54
+ * @result object
55
+ */
56
+ private parseDataType;
57
+ /**
58
+ * Create command from argument lookup
59
+ * @param argument lookup
60
+ * @result command
61
+ * @throws Error
62
+ */
63
+ commandFromLookup(argumentLookup: ArgumentLookup): Command;
64
+ }
65
+
66
+ declare class CommandLineArgumentFactory {
67
+ /**s
68
+ * Create string argument
69
+ * Examples:
70
+ * --dir="/var/www/test"
71
+ * -d="/var/www/test"
72
+ *
73
+ * @param propertyName - string
74
+ * @param description - string
75
+ * @param required - boolean
76
+ * @param argumentName - string
77
+ * @param alias - string
78
+ * @param defaultValue - string
79
+ * @param allowedValues
80
+ * @param regularExpression
81
+ */
82
+ keyStringValueArgument(propertyName: string, description: string, required: boolean, argumentName: string, alias: string, defaultValue?: string | null, allowedValues?: string[] | null, regularExpression?: RegExp | null): CommandLineArgument<string>;
83
+ keyNumberValueArgument(propertyName: string, description: string, required: boolean, argumentName: string, alias: string, defaultValue?: number | null, allowedValues?: number[] | null, regularExpression?: RegExp | null): CommandLineArgument<number>;
84
+ /**
85
+ * Create boolean argument
86
+ * Examples:
87
+ * --force
88
+ * -f
89
+ *
90
+ * @param propertyName - string
91
+ * @param description - string
92
+ * @param argumentName - string
93
+ * @param alias - string
94
+ */
95
+ flagArgument(propertyName: string, description: string, argumentName: string, alias: string): CommandLineArgument<boolean>;
96
+ /**
97
+ * Create command
98
+ * Examples:
99
+ * init
100
+ *
101
+ * @param propertyName - string
102
+ * @param description
103
+ * @param required - boolean
104
+ * @param allowedValues
105
+ * @param regularExpression
106
+ */
107
+ stringValueArgument(propertyName: string, description: string, required: boolean, allowedValues?: string[] | null, regularExpression?: RegExp | null): CommandLineArgument<string>;
108
+ numberValueArgument(propertyName: string, description: string, required: boolean, allowedValues?: number[] | null, regularExpression?: RegExp | null): CommandLineArgument<number>;
109
+ }
110
+
111
+ declare class CommandLineDirector {
112
+ private title;
113
+ private description;
114
+ private commandLines;
115
+ constructor(title: string, description: string, commandLines: CommandLine[]);
116
+ private removeQuotes;
117
+ private createArgumentLookupFromProcessArguments;
118
+ parseArguments(cmdArguments: string[], verbose: boolean): Command | null;
119
+ parse(verbose?: boolean): Command | null;
120
+ generateHelp(): string;
121
+ }
122
+
123
+ export { ArgumentLookup, Command, CommandLine, CommandLineArgument, CommandLineArgumentDataType, CommandLineArgumentFactory, CommandLineArgumentType, CommandLineDirector };
package/dist/index.js CHANGED
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  ArgumentLookup: () => ArgumentLookup,
24
24
  Command: () => Command,
25
25
  CommandLine: () => CommandLine,
@@ -29,7 +29,7 @@ __export(src_exports, {
29
29
  CommandLineArgumentType: () => CommandLineArgumentType,
30
30
  CommandLineDirector: () => CommandLineDirector
31
31
  });
32
- module.exports = __toCommonJS(src_exports);
32
+ module.exports = __toCommonJS(index_exports);
33
33
 
34
34
  // src/argument-lookup.ts
35
35
  var ArgumentLookup = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "command-line-director",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.5",
4
4
  "description": "Gives direction to you nodejs command line application",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -15,6 +15,7 @@
15
15
  "bugs": "https://github.com/marcojonker/command-line-director/issues",
16
16
  "license": "MIT",
17
17
  "scripts": {
18
+ "changelog": "auto-changelog --hide-empty-releases --template changelog-template.hbs -p && git add CHANGELOG.md",
18
19
  "build": "tsup src/index.ts --format cjs,esm --dts --out-dir dist",
19
20
  "prepare": "npm run build",
20
21
  "test": "jest --coverage",
@@ -26,7 +27,7 @@
26
27
  "package.json",
27
28
  "README.md",
28
29
  "LICENSE",
29
- "CHANGELOG",
30
+ "CHANGELOG.md",
30
31
  "dist"
31
32
  ],
32
33
  "repository": {
@@ -37,12 +38,13 @@
37
38
  "devDependencies": {
38
39
  "@eslint/js": "^9.39.1",
39
40
  "@types/node": "^20.14.12",
41
+ "auto-changelog": "^2.5.0",
40
42
  "eslint": "^9.39.1",
41
43
  "jest": "^29.7.0",
42
44
  "ts-jest": "^29.2.5",
43
45
  "ts-node": "^10.9.2",
44
46
  "ts-node-dev": "^2.0.0",
45
- "tsup": "^6.7.0",
47
+ "tsup": "^8.5.1",
46
48
  "typescript": "^5.9.3",
47
49
  "typescript-eslint": "^8.48.1"
48
50
  },
package/CHANGELOG DELETED
@@ -1,26 +0,0 @@
1
- # Change Log
2
- All notable changes to this project will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
4
-
5
- ## [Unreleased]
6
-
7
- ## [1.0.3] - 2025-01-12
8
-
9
- ### Fixes
10
- - Bump versions
11
-
12
- ## [1.0.2] - 2025-30-11
13
-
14
- ### Fixes
15
- - Bump versions
16
- - Add github actions
17
-
18
- ## [1.0.1] - 2023-18-11
19
-
20
- ### Added
21
- - Initial release
22
-
23
- ## [1.0.0] - 2021-21-09
24
-
25
- ### Added
26
- - Initial release