Skip to content

Commit

Permalink
Fix open jv files
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Sep 1, 2020
1 parent 4513d07 commit cbc6860
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/Javinizer/Public/Javinizer.ps1
Expand Up @@ -290,17 +290,20 @@ function Javinizer {
[Parameter(ParameterSetName = 'Settings')]
[Switch]$OpenThumbs,

[Parameter(ParameterSetName = 'Settings')]
[Switch]$OpenGenres,

[Parameter(Mandatory = $true, ParameterSetName = 'Thumbs')]
[Switch]$UpdateThumbs,

[Parameter(ParameterSetName = 'Thumbs')]
[PSObject]$Pages,

[Parameter(ParameterSetName = 'Version')]
[Parameter(Mandatory = $true, ParameterSetName = 'Version')]
[Alias('v')]
[Switch]$Version,

[Parameter(ParameterSetName = 'Help')]
[Parameter(Mandatory = $true, ParameterSetName = 'Help')]
[Alias('h')]
[Switch]$Help
)
Expand Down Expand Up @@ -350,7 +353,7 @@ function Javinizer {
if (!(Test-Path -LiteralPath $Settings.'sort.metadata.genrecsv.path' -PathType Leaf)) {
New-Item -LiteralPath $Settings.'sort.metadata.genrecsv.path'
}
$thumbCsvPath = $Settings.'sort.metadata.genrecsv.path'
$genreCsvPath = $Settings.'sort.metadata.genrecsv.path'
}

switch ($PsCmdlet.ParameterSetName) {
Expand Down Expand Up @@ -420,8 +423,9 @@ function Javinizer {
}

'Settings' {
if ($OpenSettings.IsPresent) {
if ($OpenSettings) {
try {
Write-Host "[$($MyInvocation.MyCommand.Name)] [SettingsPath - $settingsPath]"
Invoke-Item -LiteralPath $settingsPath
} catch {
Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening settings file [$settingsPath]: $PSItem"
Expand All @@ -430,15 +434,26 @@ function Javinizer {

if ($OpenLog) {
try {
Write-Host "[$($MyInvocation.MyCommand.Name)] [LogPath - $logPath]"
Invoke-Item -LiteralPath $logPath
} catch {
Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening log file [$logPath]: $PSItem"
}
}

elseif ($OpenThumbs) {
if ($OpenThumbs) {
try {
Write-Host "[$($MyInvocation.MyCommand.Name)] [ThumbCsvPath - $thumbCsvPath]"
Invoke-Item -LiteralPath $thumbCsvPath
} catch {
Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening thumbcsv file [$]: $PSItem"
}
}

if ($OpenGenres) {
try {
Invoke-Item -LiteralPath (Join-Path $ScriptRoot -ChildPath 'r18-thumbs.csv')
Write-Host "[$($MyInvocation.MyCommand.Name)] [GenreCsvPath - $genreCsvPath]"
Invoke-Item -LiteralPath $genreCsvPath
} catch {
Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening thumbcsv file [$]: $PSItem"
}
Expand Down

0 comments on commit cbc6860

Please sign in to comment.