mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 13:07:03 +03:00
Change UI to allow disabling squeezelite
This commit is contained in:
48
ToggleGitTracking.ps1
Normal file
48
ToggleGitTracking.ps1
Normal file
@@ -0,0 +1,48 @@
|
||||
param (
|
||||
[Parameter(Position=0, Mandatory=$false)]
|
||||
[ValidateSet("t", "u")]
|
||||
[string]$option
|
||||
)
|
||||
|
||||
# Define the directory to apply changes to
|
||||
$targetDir = "components\wifi-manager\webapp\dist"
|
||||
|
||||
# Get the current directory
|
||||
$currentDir = Get-Location
|
||||
|
||||
# Get list of files from the file system
|
||||
$fsFiles = Get-ChildItem -Recurse $targetDir -File | ForEach-Object {
|
||||
$_.FullName.Substring($currentDir.Path.Length + 1).Replace("\", "/")
|
||||
}
|
||||
|
||||
# Get list of files from the Git index
|
||||
$indexFiles = git ls-files -s $targetDir | ForEach-Object {
|
||||
($_ -split "\s+")[3]
|
||||
}
|
||||
|
||||
# Combine and remove duplicates
|
||||
$allFiles = $fsFiles + $indexFiles | Sort-Object -Unique
|
||||
|
||||
# Apply the git command based on the option
|
||||
$allFiles | ForEach-Object {
|
||||
$relativePath = $_
|
||||
$isInIndex = $indexFiles -contains $relativePath
|
||||
|
||||
if ($null -eq $option) {
|
||||
$status = if ($isInIndex) { 'tracked' } else { 'not tracked' }
|
||||
Write-Host "$relativePath is $status"
|
||||
}
|
||||
elseif ($isInIndex) {
|
||||
if ($option -eq "t") {
|
||||
git update-index --no-skip-worktree $relativePath
|
||||
Write-Host "Started tracking changes in $relativePath"
|
||||
}
|
||||
elseif ($option -eq "u") {
|
||||
git update-index --skip-worktree $relativePath
|
||||
Write-Host "Stopped tracking changes in $relativePath"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "File $relativePath is not tracked."
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user