Skip to content

Commit

Permalink
Comment Spacing, Indentation, and Capitalization (#1084)
Browse files Browse the repository at this point in the history
* Comment Spacing, Indentation, and Capitalization

* Comment Grammar and Spacing

Makes grammar in comments better and more consistent
Adds space before comment and centers word in `Write-Host` commands

* More Grammar and Formatting

* Add some comments

* Populate PlaceHolder comments in functions

Files I found that has issues:
Get-WinUtilRegistry.ps1
Install-WinUtilWinget.ps1
Invoke-WinUtilDarkMode.ps1
Remove-WinUtilAPPX.ps1
Test-WinUtilPackageManager.ps1
Update-WinUtilProgramWinget.ps1

Invoke-WPFUpdatessecurity.ps1

* Tweak a few more comments

* Tweak another write-host statement

* Undo Catch statement adjustment

It's outside of the scope of this pull request
  • Loading branch information
Carterpersall authored Oct 4, 2023
1 parent 807b0fb commit 672b083
Show file tree
Hide file tree
Showing 52 changed files with 439 additions and 298 deletions.
30 changes: 15 additions & 15 deletions config/helperscript.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#This file is meant to assist in building out the json files inside this folder.
# This file is meant to assist in building out the json files inside this folder.

#===========================================================================
# applications.json
Expand Down Expand Up @@ -35,7 +35,7 @@ Example:
#>

#Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
# Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
#------Do not delete WPF------

$NameofButton = "WPF" + ""
Expand All @@ -45,7 +45,7 @@ $ChocoCommand = ""
$ButtonToAdd = New-Object psobject
$jsonfile = Get-Content ./config/applications.json | ConvertFrom-Json

#remove if already exists
# Remove if already exists
if($jsonfile.$NameofButton){
$jsonfile.psobject.Properties.remove($NameofButton)
}
Expand Down Expand Up @@ -88,7 +88,7 @@ Example:
}
#>

#Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
# Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.

$NameofButton = ""
$commands = @(
Expand All @@ -97,7 +97,7 @@ $commands = @(

$jsonfile = Get-Content ./config/feature.json | ConvertFrom-Json

#remove if already exists
# Remove if already exists
if($jsonfile.$NameofButton){
$jsonfile.psobject.Properties.remove($NameofButton)
}
Expand Down Expand Up @@ -150,7 +150,7 @@ Example:
}
#>

#Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
# Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.

$NameofButton = "WPF" + ""
$commands = @(
Expand All @@ -159,7 +159,7 @@ $commands = @(

$jsonfile = Get-Content ./config/preset.json | ConvertFrom-Json

#remove if already exists
# Remove if already exists
if($jsonfile.$NameofButton){
$jsonfile.psobject.Properties.remove($NameofButton)
}
Expand Down Expand Up @@ -286,11 +286,11 @@ Example:
#>

#Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
#Make sure to uncomment the sections you which to add.
# Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
# Make sure to uncomment the sections you which to add.

#$Registry = @(
# #to add more repeat this separated by a comma
# # To add more repeat this separated by a comma
# @{
# Path = ""
# Name = ""
Expand All @@ -301,7 +301,7 @@ Example:
#)

#$Service = @(
# #to add more repeat this separated by a comma
# # To add more repeat this separated by a comma
# @{
# Name = ""
# StartupType = ""
Expand All @@ -310,7 +310,7 @@ Example:
#)

#$ScheduledTask = @(
# #to add more repeat this separated by a comma
# # To add more repeat this separated by a comma
# @{
# Name = ""
# State = ""
Expand All @@ -335,7 +335,7 @@ $NameofButton = "WPF" + ""
$ButtonToAdd = New-Object psobject
$jsonfile = Get-Content ./config/tweaks.json | ConvertFrom-Json

#remove if already exists
# Remove if already exists
if($jsonfile.$NameofButton){
$jsonfile.psobject.Properties.remove($NameofButton)
}
Expand Down Expand Up @@ -378,7 +378,7 @@ Example:
}
#>

#Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.
# Modify the variables and run his code. It will import the current file and add your addition. From there you can create a pull request.

$NameofProvider = "" -replace " ","_"
$IPAddress = @{
Expand All @@ -389,7 +389,7 @@ $IPAddress = @{
$ButtonToAdd = New-Object psobject
$jsonfile = Get-Content ./config/dns.json | ConvertFrom-Json

#remove if already exists
# Remove if already exists
if($jsonfile.$NameofProvider){
$jsonfile.psobject.Properties.remove($NameofProvider)
}
Expand Down
14 changes: 10 additions & 4 deletions functions/private/Get-WinUtilCheckBoxes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ Function Get-WinUtilCheckBoxes {

<#
.DESCRIPTION
Function is meant to find all checkboxes that are checked on the specific tab and input them into a script.
.SYNOPSIS
Finds all checkboxes that are checked on the specific tab and inputs them into a script.
Outputed data will be the names of the checkboxes that were checked
.PARAMETER Group
The group of checkboxes to check
.EXAMPLE
.PARAMETER unCheck
Whether to uncheck the checkboxes that are checked. Defaults to true
.OUTPUTS
A List containing the name of each checked checkbox
.EXAMPLE
Get-WinUtilCheckBoxes "WPFInstall"
#>
Expand Down
14 changes: 10 additions & 4 deletions functions/private/Get-WinUtilInstallerProcess.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
function Get-WinUtilInstallerProcess {
<#
.DESCRIPTION
Meant to check for running processes and will return a boolean response
.SYNOPSIS
Checks if the given process is running
.PARAMETER Process
The process to check
.OUTPUTS
Boolean - True if the process is running
#>

param($Process)
Expand Down
11 changes: 5 additions & 6 deletions functions/private/Get-WinUtilRegistry.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
function Get-WinUtilRegistry {
<#
.DESCRIPTION
This function will make all modifications to the registry
.EXAMPLE
.SYNOPSIS
Gets the value of a registry key
.EXAMPLE
Get-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
#>
param (
$Name,
Expand Down
15 changes: 9 additions & 6 deletions functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Function Get-WinUtilToggleStatus {
<#
.DESCRIPTION
Meant to pull the registry keys for a toggle switch and returns true or false
True should mean status is enabled
False should mean status is disabled
.SYNOPSIS
Pulls the registry keys for the given toggle switch and checks whether the toggle should be checked or unchecked
.PARAMETER ToggleSwitch
The name of the toggle to check
.OUTPUTS
Boolean to set the toggle's status to
#>

Param($ToggleSwitch)
Expand Down
11 changes: 7 additions & 4 deletions functions/private/Get-WinUtilVariables.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
function Get-WinUtilVariables {

<#
.DESCRIPTION
placeholder
.SYNOPSIS
Gets every form object of the provided type
.OUTPUTS
List containing every object that matches the provided type
#>
param (
[Parameter()]
Expand Down
10 changes: 5 additions & 5 deletions functions/private/Install-WinUtilChoco.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function Install-WinUtilChoco {

<#
.DESCRIPTION
Function is meant to ensure Choco is installed
.SYNOPSIS
Installs Chocolatey if it is not already installed
#>

try{
Expand All @@ -16,7 +16,7 @@ function Install-WinUtilChoco {
}

Write-Host "Seems Chocolatey is not installed, installing now?"
#Let user decide if he wants to install Chocolatey
# Let user decide if they want to install Chocolatey
$confirmation = Read-Host "Are you Sure You Want To Proceed:(y/n)"
if ($confirmation -eq 'y') {
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
Expand Down
17 changes: 12 additions & 5 deletions functions/private/Install-WinUtilProgramWinget.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
Function Install-WinUtilProgramWinget {

<#
.DESCRIPTION
This will install programs via Winget using a new powershell.exe instance to prevent the GUI from locking up.
Note the triple quotes are required any time you need a " in a normal script block.
.SYNOPSIS
Manages the provided programs using Winget
.PARAMETER ProgramsToInstall
A list of programs to manage
.PARAMETER manage
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
.NOTES
The triple quotes are required any time you need a " in a normal script block.
#>

param(
Expand Down
18 changes: 9 additions & 9 deletions functions/private/Install-WinUtilWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ function Get-LatestHash {
$WebClient.DownloadFile($shaUrl, $shaFile)

Get-Content $shaFile
}
}

function Install-WinUtilWinget {

<#
.DESCRIPTION
Function is meant to ensure winget is installed
.SYNOPSIS
Installs Winget if it is not already installed
#>
Try{
Write-Host "Checking if Winget is Installed..."
if (Test-WinUtilPackageManager -winget) {
#Checks if winget executable exists and if the Windows Version is 1809 or higher
# Checks if winget executable exists and if the Windows Version is 1809 or higher
Write-Host "Winget Already Installed"
return
}

#Gets the computer's information
# Gets the computer's information
if ($null -eq $sync.ComputerInfo){
$ComputerInfo = Get-ComputerInfo -ErrorAction Stop
}
Expand All @@ -32,7 +32,7 @@ function Install-WinUtilWinget {
}

if (($ComputerInfo.WindowsVersion) -lt "1809") {
#Checks if Windows Version is too old for winget
# Checks if Windows Version is too old for winget
Write-Host "Winget is not supported on this version of Windows (Pre-1809)"
return
}
Expand Down
13 changes: 8 additions & 5 deletions functions/private/Invoke-WinUtilBingSearch.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
function Invoke-WinUtilBingSearch {
<#
.DESCRIPTION
Sets Bing Search on or off
<#
.SYNOPSIS
Disables/Enables Bing Search
.PARAMETER Enabled
Indicates whether to enable or disable Bing Search
#>
Param($Enabled)
Try{
Expand Down
9 changes: 3 additions & 6 deletions functions/private/Invoke-WinUtilCurrentSystem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ Function Invoke-WinUtilCurrentSystem {

<#
.DESCRIPTION
Function is meant to read existing system registry and check according configuration.
Example: Is telemetry enabled? check the box.
.EXAMPLE
.SYNOPSIS
Checks to see what tweaks have already been applied and what programs are installed, and checks the according boxes
.EXAMPLE
Get-WinUtilCheckBoxes "WPFInstall"
#>
Expand Down
13 changes: 8 additions & 5 deletions functions/private/Invoke-WinUtilDarkMode.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Function Invoke-WinUtilDarkMode {
<#
.DESCRIPTION
Sets Dark Mode on or off
<#
.SYNOPSIS
Enables/Disables Dark Mode
.PARAMETER DarkMoveEnabled
Indicates the current dark mode state
#>
Param($DarkMoveEnabled)
Try{
Expand Down
8 changes: 4 additions & 4 deletions functions/private/Invoke-WinUtilFeatureInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function Invoke-WinUtilFeatureInstall {
<#
.DESCRIPTION
This function converts all the values from the tweaks.json and routes them to the appropriate function
.SYNOPSIS
Converts all the values from the tweaks.json and routes them to the appropriate function
#>

param(
Expand Down
Loading

0 comments on commit 672b083

Please sign in to comment.