make-folder-txt 1.0.4 → 1.0.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/README.md CHANGED
@@ -53,9 +53,10 @@ That's it. A `my-project.txt` file will be created in the same directory.
53
53
  Ignore specific folders/files by name:
54
54
 
55
55
  ```bash
56
- make-folder-txt --ignore-folder logs
57
- make-folder-txt --ignore-file .env
58
- make-folder-txt --ignore-folder dist --ignore-folder coverage --ignore-file secrets.txt
56
+ make-folder-txt --ignore-folder examples extensions docs
57
+ make-folder-txt --ignore-folder examples extensions "docs and explaination"
58
+ make-folder-txt --ignore-folder examples extensions docs --ignore-file LICENSE
59
+ make-folder-txt --ignore-file .env .env.local secrets.txt
59
60
  ```
60
61
 
61
62
  ---
@@ -86,28 +86,50 @@ let outputArg = null;
86
86
  for (let i = 0; i < args.length; i += 1) {
87
87
  const arg = args[i];
88
88
 
89
- if (arg === "--ignore-folder" || arg.startsWith("--ignore-folder=")) {
90
- const value = arg.startsWith("--ignore-folder=")
91
- ? arg.slice("--ignore-folder=".length)
92
- : args[i + 1];
93
- if (!value || value.startsWith("-")) {
89
+ if (arg === "--ignore-folder") {
90
+ let consumed = 0;
91
+ while (i + 1 < args.length && !args[i + 1].startsWith("-")) {
92
+ ignoreDirs.add(args[i + 1]);
93
+ i += 1;
94
+ consumed += 1;
95
+ }
96
+ if (consumed === 0) {
97
+ console.error("Error: --ignore-folder requires at least one folder name.");
98
+ process.exit(1);
99
+ }
100
+ continue;
101
+ }
102
+
103
+ if (arg.startsWith("--ignore-folder=")) {
104
+ const value = arg.slice("--ignore-folder=".length);
105
+ if (!value) {
94
106
  console.error("Error: --ignore-folder requires a folder name.");
95
107
  process.exit(1);
96
108
  }
97
- if (!arg.includes("=")) i += 1;
98
109
  ignoreDirs.add(value);
99
110
  continue;
100
111
  }
101
112
 
102
- if (arg === "--ignore-file" || arg.startsWith("--ignore-file=")) {
103
- const value = arg.startsWith("--ignore-file=")
104
- ? arg.slice("--ignore-file=".length)
105
- : args[i + 1];
106
- if (!value || value.startsWith("-")) {
113
+ if (arg === "--ignore-file") {
114
+ let consumed = 0;
115
+ while (i + 1 < args.length && !args[i + 1].startsWith("-")) {
116
+ ignoreFiles.add(args[i + 1]);
117
+ i += 1;
118
+ consumed += 1;
119
+ }
120
+ if (consumed === 0) {
121
+ console.error("Error: --ignore-file requires at least one file name.");
122
+ process.exit(1);
123
+ }
124
+ continue;
125
+ }
126
+
127
+ if (arg.startsWith("--ignore-file=")) {
128
+ const value = arg.slice("--ignore-file=".length);
129
+ if (!value) {
107
130
  console.error("Error: --ignore-file requires a file name.");
108
131
  process.exit(1);
109
132
  }
110
- if (!arg.includes("=")) i += 1;
111
133
  ignoreFiles.add(value);
112
134
  continue;
113
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-folder-txt",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
5
5
  "main": "bin/make-folder-txt.js",
6
6
  "bin": {