@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@himamshus06/git-auto",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "bin": {
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. Press Enter on an empty line to finish:');
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
- // Each ancestor level draws a fixed 4-char block ("│ " or " ").
44
- // +1 because having a connector at all means "at least one level below root".
45
- depth = Math.round(prefix.length / 4) + 1;
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 any remaining connector/line-drawing/space characters to get the name.
50
- let name = rest.replace(new RegExp(`^${PREFIX_CHARS.source}+`), '').trim();
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;