Skip to content

Commit

Permalink
Merge pull request #7 from Romanitho/dev
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
Romanitho committed Apr 3, 2022
2 parents 0cacdc6 + ce53772 commit a4ab46b
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions winget-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,24 @@ param(
function Init {
#Logs initialisation
if (!(Test-Path $LogPath)){
New-Item -ItemType Directory -Force -Path $LogPath
New-Item -ItemType Directory -Force -Path $LogPath | Out-Null
}

#Log file
Write-Log "Log path is: $LogPath\install.log"
$Script:LogFile = "$LogPath\install.log"

#Log Header
if ($Uninstall){
Write-Log "### $(Get-Date -Format 'dd/MM/yyyy') - NEW UNINSTALL REQUEST ###" "Cyan"
Write-Log "### $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern) - NEW UNINSTALL REQUEST ###" "Magenta"
}
else{
Write-Log "### $(Get-Date -Format 'dd/MM/yyyy') - NEW INSTALL REQUEST ###" "Cyan"
Write-Log "### $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern) - NEW INSTALL REQUEST ###" "Magenta"
}
}

#Log Function
function Write-Log ($LogMsg,$LogColor = "White") {
function Write-Log ($LogMsg, $LogColor = "White") {
#Get log
$Log = "$(Get-Date -UFormat "%T") - $LogMsg"
#Echo log
Expand Down Expand Up @@ -162,11 +163,13 @@ function Uninstall-App ($AppID){

<# MAIN #>

Write-host "###################################"
Write-host "# #"
Write-host "# Winget Install #"
Write-host "# #"
Write-host "###################################`n"
Write-host "`n"
Write-host "`t###################################"
Write-host "`t# #"
Write-host "`t# Winget Install #"
Write-host "`t# #"
Write-host "`t###################################"
Write-Host "`n"

#Run Init Function
Init
Expand All @@ -176,6 +179,7 @@ Get-WingetCmd

#Run install or uninstall for all apps
foreach ($AppID in $AppIDs){
#Check if app exists
$Exists = Confirm-Exist $AppID
if ($Exists){
#Install or Uninstall command
Expand All @@ -186,4 +190,5 @@ foreach ($AppID in $AppIDs){
Install-App $AppID
}
}
Start-Sleep 3
}

0 comments on commit a4ab46b

Please sign in to comment.