make-folder-txt 2.1.3 → 2.2.0
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/bin/make-folder-txt.js +24 -4
- package/package.json +1 -1
- package/completion/install-powershell-completion.ps1 +0 -75
- package/completion/make-folder-txt-completion.bash +0 -59
- package/completion/make-folder-txt-completion.ps1 +0 -95
- package/completion/make-folder-txt-completion.zsh +0 -30
- package/make-folder-txt.txt +0 -52
package/bin/make-folder-txt.js
CHANGED
|
@@ -617,7 +617,12 @@ for (let i = 0; i < args.length; i += 1) {
|
|
|
617
617
|
if (arg === "--ignore-folder" || arg === "-ifo") {
|
|
618
618
|
let consumed = 0;
|
|
619
619
|
while (i + 1 < args.length && !args[i + 1].startsWith("-")) {
|
|
620
|
-
|
|
620
|
+
// Normalize the folder name: remove backslashes, trailing slashes, and leading ./
|
|
621
|
+
let folderName = args[i + 1];
|
|
622
|
+
folderName = folderName.replace(/\\/g, '/'); // Convert backslashes to forward slashes
|
|
623
|
+
folderName = folderName.replace(/^\.?\//, ''); // Remove leading ./ or /
|
|
624
|
+
folderName = folderName.replace(/\/+$/, ''); // Remove trailing slashes
|
|
625
|
+
ignoreDirs.add(folderName);
|
|
621
626
|
i += 1;
|
|
622
627
|
consumed += 1;
|
|
623
628
|
}
|
|
@@ -636,7 +641,12 @@ for (let i = 0; i < args.length; i += 1) {
|
|
|
636
641
|
console.error("Error: --ignore-folder requires a folder name.");
|
|
637
642
|
process.exit(1);
|
|
638
643
|
}
|
|
639
|
-
|
|
644
|
+
// Normalize the folder name
|
|
645
|
+
let folderName = value;
|
|
646
|
+
folderName = folderName.replace(/\\/g, '/'); // Convert backslashes to forward slashes
|
|
647
|
+
folderName = folderName.replace(/^\.?\//, ''); // Remove leading ./ or /
|
|
648
|
+
folderName = folderName.replace(/\/+$/, ''); // Remove trailing slashes
|
|
649
|
+
ignoreDirs.add(folderName);
|
|
640
650
|
continue;
|
|
641
651
|
}
|
|
642
652
|
|
|
@@ -669,7 +679,12 @@ for (let i = 0; i < args.length; i += 1) {
|
|
|
669
679
|
if (arg === "--only-folder" || arg === "-ofo") {
|
|
670
680
|
let consumed = 0;
|
|
671
681
|
while (i + 1 < args.length && !args[i + 1].startsWith("-")) {
|
|
672
|
-
|
|
682
|
+
// Normalize the folder name
|
|
683
|
+
let folderName = args[i + 1];
|
|
684
|
+
folderName = folderName.replace(/\\/g, '/'); // Convert backslashes to forward slashes
|
|
685
|
+
folderName = folderName.replace(/^\.?\//, ''); // Remove leading ./ or /
|
|
686
|
+
folderName = folderName.replace(/\/+$/, ''); // Remove trailing slashes
|
|
687
|
+
onlyFolders.add(folderName);
|
|
673
688
|
i += 1;
|
|
674
689
|
consumed += 1;
|
|
675
690
|
}
|
|
@@ -688,7 +703,12 @@ for (let i = 0; i < args.length; i += 1) {
|
|
|
688
703
|
console.error("Error: --only-folder requires a folder name.");
|
|
689
704
|
process.exit(1);
|
|
690
705
|
}
|
|
691
|
-
|
|
706
|
+
// Normalize the folder name
|
|
707
|
+
let folderName = value;
|
|
708
|
+
folderName = folderName.replace(/\\/g, '/'); // Convert backslashes to forward slashes
|
|
709
|
+
folderName = folderName.replace(/^\.?\//, ''); // Remove leading ./ or /
|
|
710
|
+
folderName = folderName.replace(/\/+$/, ''); // Remove trailing slashes
|
|
711
|
+
onlyFolders.add(folderName);
|
|
692
712
|
continue;
|
|
693
713
|
}
|
|
694
714
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "make-folder-txt",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
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": {
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# PowerShell completion installation script for make-folder-txt
|
|
2
|
-
|
|
3
|
-
function Install-MakeFolderTxtCompletion {
|
|
4
|
-
param(
|
|
5
|
-
[switch]$Force,
|
|
6
|
-
[switch]$CurrentUser
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
$ErrorActionPreference = 'Stop'
|
|
10
|
-
|
|
11
|
-
# Determine PowerShell profile path
|
|
12
|
-
if ($CurrentUser) {
|
|
13
|
-
$profilePath = $PROFILE.CurrentUserCurrentHost
|
|
14
|
-
} else {
|
|
15
|
-
$profilePath = $PROFILE.AllUsersCurrentHost
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# Create profile directory if it doesn't exist
|
|
19
|
-
$profileDir = Split-Path $profilePath -Parent
|
|
20
|
-
if (-not (Test-Path $profileDir)) {
|
|
21
|
-
try {
|
|
22
|
-
New-Item -ItemType Directory -Path $profileDir -Force | Out-Null
|
|
23
|
-
Write-Host "Created profile directory: $profileDir" -ForegroundColor Green
|
|
24
|
-
} catch {
|
|
25
|
-
Write-Error "Failed to create profile directory: $profileDir"
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# Get the completion script content
|
|
31
|
-
$completionScriptPath = Join-Path $PSScriptRoot 'make-folder-txt-completion.ps1'
|
|
32
|
-
if (-not (Test-Path $completionScriptPath)) {
|
|
33
|
-
Write-Error "Completion script not found: $completionScriptPath"
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
$completionContent = Get-Content $completionScriptPath -Raw
|
|
38
|
-
|
|
39
|
-
# Check if completion is already installed
|
|
40
|
-
if (Test-Path $profilePath) {
|
|
41
|
-
$profileContent = Get-Content $profilePath -Raw
|
|
42
|
-
if ($profileContent -match 'make-folder-txt.*completion') {
|
|
43
|
-
if (-not $Force) {
|
|
44
|
-
Write-Host "make-folder-txt completion is already installed in $profilePath" -ForegroundColor Yellow
|
|
45
|
-
Write-Host "Use -Force to reinstall" -ForegroundColor Yellow
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
Write-Host "Removing existing completion..." -ForegroundColor Yellow
|
|
49
|
-
# Remove existing completion
|
|
50
|
-
$profileContent = $profileContent -replace '(?s)# make-folder-txt completion.*?Register-ArgumentComplester.*?Export-ModuleMember.*?\n', ''
|
|
51
|
-
Set-Content $profilePath $profileContent -Force
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
# Add completion to profile
|
|
56
|
-
$completionBlock = @"
|
|
57
|
-
|
|
58
|
-
# make-folder-txt completion
|
|
59
|
-
$completionContent
|
|
60
|
-
"@
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
Add-Content $profilePath $completionBlock -Force
|
|
64
|
-
Write-Host "✅ PowerShell completion installed successfully!" -ForegroundColor Green
|
|
65
|
-
Write-Host "Added to: $profilePath" -ForegroundColor Cyan
|
|
66
|
-
Write-Host "Restart PowerShell or run: . `$profile" -ForegroundColor Cyan
|
|
67
|
-
} catch {
|
|
68
|
-
Write-Error "Failed to install completion: $_"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
# Auto-install if script is run directly
|
|
73
|
-
if ($MyInvocation.InvocationName -eq $MyInvocation.MyCommand.Name) {
|
|
74
|
-
Install-MakeFolderTxtCompletion -CurrentUser
|
|
75
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# make-folder-txt bash completion
|
|
3
|
-
|
|
4
|
-
_make_folder_txt_completion() {
|
|
5
|
-
local cur prev opts
|
|
6
|
-
COMPREPLY=()
|
|
7
|
-
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
8
|
-
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
9
|
-
|
|
10
|
-
opts="--ignore-folder -ifo --ignore-file -ifi --only-folder -ofo --only-file -ofi --skip-large --no-skip --split-method --split-size --copy --force --help --version -h -v"
|
|
11
|
-
|
|
12
|
-
case "${prev}" in
|
|
13
|
-
--ignore-folder|-ifo)
|
|
14
|
-
# Complete with folder names in current directory
|
|
15
|
-
local folders=$(ls -d */ 2>/dev/null | sed 's|/||g')
|
|
16
|
-
COMPREPLY=( $(compgen -W "${folders}" -- ${cur}) )
|
|
17
|
-
return 0
|
|
18
|
-
;;
|
|
19
|
-
--ignore-file|-ifi|--only-file|-ofi)
|
|
20
|
-
# Complete with file names in current directory
|
|
21
|
-
local files=$(ls -p 2>/dev/null | grep -v /)
|
|
22
|
-
COMPREPLY=( $(compgen -W "${files}" -- ${cur}) )
|
|
23
|
-
return 0
|
|
24
|
-
;;
|
|
25
|
-
--only-folder|-ofo)
|
|
26
|
-
# Complete with folder names in current directory
|
|
27
|
-
local folders=$(ls -d */ 2>/dev/null | sed 's|/||g')
|
|
28
|
-
COMPREPLY=( $(compgen -W "${folders}" -- ${cur}) )
|
|
29
|
-
return 0
|
|
30
|
-
;;
|
|
31
|
-
--skip-large)
|
|
32
|
-
# Complete with common size formats
|
|
33
|
-
local sizes="100KB 200KB 400KB 500KB 1MB 5MB 10MB 100MB 1GB 5GB"
|
|
34
|
-
COMPREPLY=( $(compgen -W "${sizes}" -- ${cur}) )
|
|
35
|
-
return 0
|
|
36
|
-
;;
|
|
37
|
-
--split-method)
|
|
38
|
-
# Complete with split methods
|
|
39
|
-
local methods="folder file size"
|
|
40
|
-
COMPREPLY=( $(compgen -W "${methods}" -- ${cur}) )
|
|
41
|
-
return 0
|
|
42
|
-
;;
|
|
43
|
-
--split-size)
|
|
44
|
-
# Complete with common size formats
|
|
45
|
-
local sizes="1MB 5MB 10MB 50MB 100MB 500MB 1GB"
|
|
46
|
-
COMPREPLY=( $(compgen -W "${sizes}" -- ${cur}) )
|
|
47
|
-
return 0
|
|
48
|
-
;;
|
|
49
|
-
*)
|
|
50
|
-
;;
|
|
51
|
-
esac
|
|
52
|
-
|
|
53
|
-
if [[ ${cur} == -* ]]; then
|
|
54
|
-
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
55
|
-
return 0
|
|
56
|
-
fi
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
complete -F _make_folder_txt_completion make-folder-txt
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# make-folder-txt PowerShell completion script
|
|
2
|
-
|
|
3
|
-
Register-ArgumentCompleter -Native -CommandName 'make-folder-txt' -ScriptBlock {
|
|
4
|
-
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
5
|
-
|
|
6
|
-
# Get the current argument being completed
|
|
7
|
-
$currentArgument = $wordToComplete
|
|
8
|
-
|
|
9
|
-
# Define available options
|
|
10
|
-
$options = @(
|
|
11
|
-
'--ignore-folder', '-ifo',
|
|
12
|
-
'--ignore-file', '-ifi',
|
|
13
|
-
'--only-folder', '-ofo',
|
|
14
|
-
'--only-file', '-ofi',
|
|
15
|
-
'--skip-large',
|
|
16
|
-
'--no-skip',
|
|
17
|
-
'--split-method',
|
|
18
|
-
'--split-size',
|
|
19
|
-
'--copy',
|
|
20
|
-
'--force',
|
|
21
|
-
'--install-completion',
|
|
22
|
-
'--help', '-h',
|
|
23
|
-
'--version', '-v'
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
# Get the previous parameter to determine context
|
|
27
|
-
$previousParameter = if ($commandAst.CommandElements.Count -gt 1) {
|
|
28
|
-
$commandAst.CommandElements[-2].Extent.Text
|
|
29
|
-
} else {
|
|
30
|
-
''
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
switch ($previousParameter) {
|
|
34
|
-
{ $_ -in '--ignore-folder', '-ifo', '--only-folder', '-ofo' } {
|
|
35
|
-
# Complete with folder names
|
|
36
|
-
try {
|
|
37
|
-
$folders = Get-ChildItem -Directory -Name | Where-Object { $_ -like "*$currentArgument*" }
|
|
38
|
-
return $folders | ForEach-Object {
|
|
39
|
-
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Folder: $_")
|
|
40
|
-
}
|
|
41
|
-
} catch {
|
|
42
|
-
return @()
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
{ $_ -in '--ignore-file', '-ifi', '--only-file', '-ofi' } {
|
|
46
|
-
# Complete with file names
|
|
47
|
-
try {
|
|
48
|
-
$files = Get-ChildItem -File -Name | Where-Object { $_ -like "*$currentArgument*" }
|
|
49
|
-
return $files | ForEach-Object {
|
|
50
|
-
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "File: $_")
|
|
51
|
-
}
|
|
52
|
-
} catch {
|
|
53
|
-
return @()
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
'--skip-large' {
|
|
57
|
-
# Complete with common size formats
|
|
58
|
-
$sizes = @('100KB', '200KB', '400KB', '500KB', '1MB', '5MB', '10MB', '100MB', '1GB', '5GB')
|
|
59
|
-
$matchingSizes = $sizes | Where-Object { $_ -like "*$currentArgument*" }
|
|
60
|
-
return $matchingSizes | ForEach-Object {
|
|
61
|
-
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Size: $_")
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
'--split-method' {
|
|
65
|
-
# Complete with split methods
|
|
66
|
-
$methods = @('folder', 'file', 'size')
|
|
67
|
-
$matchingMethods = $methods | Where-Object { $_ -like "*$currentArgument*" }
|
|
68
|
-
return $matchingMethods | ForEach-Object {
|
|
69
|
-
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Method: $_")
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
'--split-size' {
|
|
73
|
-
# Complete with common size formats
|
|
74
|
-
$sizes = @('1MB', '5MB', '10MB', '50MB', '100MB', '500MB', '1GB')
|
|
75
|
-
$matchingSizes = $sizes | Where-Object { $_ -like "*$currentArgument*" }
|
|
76
|
-
return $matchingSizes | ForEach-Object {
|
|
77
|
-
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Size: $_")
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
default {
|
|
81
|
-
# Complete with options
|
|
82
|
-
if ($currentArgument -like '-*') {
|
|
83
|
-
$matchingOptions = $options | Where-Object { $_ -like "*$currentArgument*" }
|
|
84
|
-
return $matchingOptions | ForEach-Object {
|
|
85
|
-
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Option: $_")
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return @()
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
# Export the completion function
|
|
95
|
-
Export-ModuleMember -Function *
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#compdef make-folder-txt
|
|
2
|
-
# make-folder-txt zsh completion
|
|
3
|
-
|
|
4
|
-
_make_folder_txt() {
|
|
5
|
-
local -a arguments
|
|
6
|
-
arguments=(
|
|
7
|
-
'--ignore-folder[Ignore specific folders by name]:folder:_directories'
|
|
8
|
-
'-ifo[Ignore specific folders by name]:folder:_directories'
|
|
9
|
-
'--ignore-file[Ignore specific files by name]:file:_files'
|
|
10
|
-
'-ifi[Ignore specific files by name]:file:_files'
|
|
11
|
-
'--only-folder[Include only specific folders]:folder:_directories'
|
|
12
|
-
'-ofo[Include only specific folders]:folder:_directories'
|
|
13
|
-
'--only-file[Include only specific files]:file:_files'
|
|
14
|
-
'-ofi[Include only specific files]:file:_files'
|
|
15
|
-
'--skip-large[Skip files larger than specified size]:size:(100KB 200KB 400KB 500KB 1MB 5MB 10MB 100MB 1GB 5GB)'
|
|
16
|
-
'--no-skip[Include all files regardless of size]'
|
|
17
|
-
'--split-method[Split output by method]:method:(folder file size)'
|
|
18
|
-
'--split-size[Split output when size exceeds limit]:size:(1MB 5MB 10MB 50MB 100MB 500MB 1GB)'
|
|
19
|
-
'--copy[Copy output to clipboard]'
|
|
20
|
-
'--force[Include everything (overrides all ignore patterns)]'
|
|
21
|
-
'--help[Show help message]'
|
|
22
|
-
'--version[Show version information]'
|
|
23
|
-
'-h[Show help message]'
|
|
24
|
-
'-v[Show version information]'
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
_arguments -s -S $arguments && return 0
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_make_folder_txt "$@"
|
package/make-folder-txt.txt
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
================================================================================
|
|
2
|
-
START OF FOLDER: make-folder-txt
|
|
3
|
-
================================================================================
|
|
4
|
-
|
|
5
|
-
================================================================================
|
|
6
|
-
PROJECT STRUCTURE
|
|
7
|
-
================================================================================
|
|
8
|
-
Root: C:\Programming\make-folder-txt
|
|
9
|
-
|
|
10
|
-
make-folder-txt/
|
|
11
|
-
├── package.json
|
|
12
|
-
|
|
13
|
-
Total files: 1
|
|
14
|
-
|
|
15
|
-
================================================================================
|
|
16
|
-
FILE CONTENTS
|
|
17
|
-
================================================================================
|
|
18
|
-
|
|
19
|
-
--------------------------------------------------------------------------------
|
|
20
|
-
FILE: /package.json
|
|
21
|
-
--------------------------------------------------------------------------------
|
|
22
|
-
{
|
|
23
|
-
"name": "make-folder-txt",
|
|
24
|
-
"version": "2.1.2",
|
|
25
|
-
"description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
|
|
26
|
-
"main": "bin/make-folder-txt.js",
|
|
27
|
-
"bin": {
|
|
28
|
-
"make-folder-txt": "bin/make-folder-txt.js"
|
|
29
|
-
},
|
|
30
|
-
"scripts": {
|
|
31
|
-
"test": "echo \"No tests yet\" && exit 0"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"folder",
|
|
35
|
-
"dump",
|
|
36
|
-
"project",
|
|
37
|
-
"structure",
|
|
38
|
-
"txt",
|
|
39
|
-
"cli",
|
|
40
|
-
"export"
|
|
41
|
-
],
|
|
42
|
-
"author": "Muhammad Saad Amin",
|
|
43
|
-
"license": "MIT",
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=14.0.0"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
================================================================================
|
|
51
|
-
END OF FOLDER: make-folder-txt
|
|
52
|
-
================================================================================
|