@himamshus06/git-auto 1.3.8 → 1.3.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/package.json +1 -1
- package/root/folder1/file1.txt +0 -0
- package/root/folder2/file2.txt +0 -0
- package/src/index.js +2 -2
- package/src/tree.js +5 -5
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
package/src/index.js
CHANGED
|
@@ -85,12 +85,12 @@ program
|
|
|
85
85
|
.description('Create directories from a pasted directory tree')
|
|
86
86
|
.action(async () => {
|
|
87
87
|
const rl = readline.createInterface({ input, output });
|
|
88
|
-
console.log('Paste your directory tree below.
|
|
88
|
+
console.log('Paste your directory tree below. Type \'DONE\' on a new line to finish:');
|
|
89
89
|
|
|
90
90
|
let treeText = '';
|
|
91
91
|
while (true) {
|
|
92
92
|
const line = await rl.question('');
|
|
93
|
-
if (line === '') break;
|
|
93
|
+
if (line.trim().toUpperCase() === 'DONE') break;
|
|
94
94
|
treeText += line + '\n';
|
|
95
95
|
}
|
|
96
96
|
|
package/src/tree.js
CHANGED
|
@@ -40,14 +40,14 @@ function parseTree(text) {
|
|
|
40
40
|
rest = line.trim();
|
|
41
41
|
} else {
|
|
42
42
|
const prefix = line.slice(0, connectorIdx);
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
depth =
|
|
43
|
+
// Use vertical bars as markers for nesting levels.
|
|
44
|
+
// depth = (number of vertical bars in prefix) + 1.
|
|
45
|
+
depth = (prefix.match(/│/g) || []).length + 1;
|
|
46
46
|
rest = line.slice(connectorIdx);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// Strip
|
|
50
|
-
let name = rest.replace(
|
|
49
|
+
// Strip all leading characters that are not alphanumeric, dot, underscore, or hyphen.
|
|
50
|
+
let name = rest.replace(/^[^a-zA-Z0-9._-]+/, '').trim();
|
|
51
51
|
// Strip a trailing inline comment (" # explanation"), if present.
|
|
52
52
|
name = name.replace(/\s+#.*$/, '').trim();
|
|
53
53
|
if (!name) continue;
|