@trenskow/arguments-parser 0.1.7 → 0.1.9
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/lib/index.js +6 -3
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import print from '@trenskow/print';
|
|
|
14
14
|
|
|
15
15
|
export default (args = process.argv.slice(2), argvLevel = 0) => {
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const base = `${process.argv.slice(1, argvLevel + 2).map(((arg) => basename(arg))).join(' ')}`;
|
|
18
18
|
|
|
19
19
|
const list = (items) => {
|
|
20
20
|
|
|
@@ -30,12 +30,15 @@ export default (args = process.argv.slice(2), argvLevel = 0) => {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
|
+
get base() {
|
|
34
|
+
return base;
|
|
35
|
+
},
|
|
33
36
|
command: async (commands) => {
|
|
34
37
|
|
|
35
38
|
const printHelp = (error) => {
|
|
36
39
|
|
|
37
40
|
print();
|
|
38
|
-
print(`Usage: ${
|
|
41
|
+
print(`Usage: ${base} [command]`);
|
|
39
42
|
print();
|
|
40
43
|
print('Available commands:');
|
|
41
44
|
print();
|
|
@@ -111,7 +114,7 @@ export default (args = process.argv.slice(2), argvLevel = 0) => {
|
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
print();
|
|
114
|
-
print.nn(`Usage: ${
|
|
117
|
+
print.nn(`Usage: ${base} [options]`);
|
|
115
118
|
|
|
116
119
|
if (options.help?.postfix) print.nn(options.help.postfix);
|
|
117
120
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/arguments-parser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Yet another arguments parser.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"homepage": "https://github.com/trenskow/arguments-parser#readme",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@trenskow/caseit": "^1.4.6",
|
|
28
|
-
"@trenskow/print": "^0.1.
|
|
29
|
-
"isvalid": "^4.1.
|
|
28
|
+
"@trenskow/print": "^0.1.2",
|
|
29
|
+
"isvalid": "^4.1.26"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@eslint/eslintrc": "^3.2.0",
|