This commit is contained in:
Markus Fleschutz 2021-04-20 08:28:51 +02:00
commit 5807a52423
2 changed files with 6 additions and 6 deletions

View File

@ -60,10 +60,10 @@ How to edit the PowerShell Scripts?
How to write good PowerShell Scripts?
-------------------------------------
PowerShell scripts should follow the 11 golden rules:
Good PowerShell scripts are user-friendly and platform-independant. As a guideline follow the 11 golden rules, please:
1. the filename is named using the `<verb>-<object>.ps1` scheme
2. encoding is in UTF-8-BOM to support Unicode characters
2. the encoding is UTF-8-BOM to support Unicode characters (including emojis where appropriate)
3. the script has execute file permissions: chmod a+rx <file> (for Linux support)
4. the first line reads `#!/usr/bin/pwsh` (for Linux support)
5. provide a comment-based help with syntax, description, link, author, and license

View File

@ -9,12 +9,12 @@
param($RepoDir = "$PWD")
try {
$RepoDir = resolve-path "$RepoDir/"
"⏳ Cleaning $RepoDir from untracked files..."
$RepoDir = resolve-path "$RepoDir"
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir"
"⏳ Cleaning Git repository 📂$RepoDir from untracked files..."
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
@ -24,7 +24,7 @@ try {
& git submodule foreach --recursive git clean -fdx
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
"✔️ Git repository 📂$RepoDir is clean now"
"✔️ cleaned Git repository 📂$RepoDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"