Skip to content

Commit

Permalink
Merge pull request #2 from Agazoth/AddIgnoreFolders
Browse files Browse the repository at this point in the history
Added IgnoreFolders option
  • Loading branch information
dfinke authored Sep 25, 2024
2 parents 91335fe + 18d0891 commit 37c2758
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BuildPromptFromFiles.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RootModule = 'BuildPromptFromFiles.psm1'

# Version number of this module.
ModuleVersion = '0.2.1'
ModuleVersion = '0.2.2'

# ID used to uniquely identify this module
GUID = 'fa761a01-55b9-436d-8928-9dfd0ffdf978'
Expand Down
11 changes: 10 additions & 1 deletion Public/Build-PromptFromFiles.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ The output can be in raw format or XML format.
.PARAMETER Path
An array of directory paths to scan. Defaults to the current directory.
.PARAMETER ignoreFolders
An array of folder patterns to ignore.
.PARAMETER ignore
An array of file patterns to ignore. Additional patterns are added by default.
Expand All @@ -28,12 +31,16 @@ This example scans the "C:\Projects" directory, includes patterns from .gitignor
Build-PromptFromFiles -Path "C:\Projects", "D:\Work" -ignore "*.log"
This example scans the "C:\Projects" and "D:\Work" directories, ignores .log files, and outputs the content in XML format.
.EXAMPLE
Build-PromptFromFiles -Path "C:\Projects" -ignoreFolders "bin", "obj"
#>
function Build-PromptFromFiles {
[CmdletBinding()]
param (
[string[]]$Path = $pwd,
[string[]]$ignore,
[string[]]$ignoreFolders,
[Switch]$gitIgnore,
[Switch]$Raw
)
Expand All @@ -51,7 +58,9 @@ function Build-PromptFromFiles {
$ignore += (Get-GitIgnoreContent -Path $targetPath)
}

(Get-ChildItem -Path $targetPath -Recurse -File -Exclude $ignore).FullName | Sort-Object
$filteredTargetPath = Get-ChildItem -Path $targetPath -Exclude $ignoreFolders

(Get-ChildItem -Path $filteredTargetPath -Recurse -File -Exclude $ignore).FullName | Sort-Object
}

$outputText = [System.Text.StringBuilder]::new()
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.2.2

- Thank you to @Agazoth for add the `-ignoreFolders` 👍🏼

# v0.2.1

- Added `Build-PromptFromGitHubRepo`
Expand Down

0 comments on commit 37c2758

Please sign in to comment.