Skip to content

Commit

Permalink
🪲 [Fix]: Function names + simplify private functions (#3)
Browse files Browse the repository at this point in the history
## Description

- Function names + simplify private functions

## Type of change

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [ ] 📖 [Docs]
- [x] 🪲 [Fix]
- [ ] 🩹 [Patch]
- [ ] ⚠️ [Security fix]
- [ ] 🚀 [Feature]
- [ ] 🌟 [Breaking change]

## Checklist

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
  • Loading branch information
MariusStorhaug authored Mar 16, 2024
1 parent f2e2a9d commit f6b9b2e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 59 deletions.
25 changes: 0 additions & 25 deletions src/Store/private/Get-ConfigFilePath.ps1

This file was deleted.

7 changes: 5 additions & 2 deletions src/Store/private/Initialize-VariableStore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
[string] $Name
)

$configFilePath = Get-ConfigFilePath -Name $Name
$folderName = ".$($Name -replace '^\.')".ToLower()
$configFilePath = Join-Path -Path $HOME -ChildPath $folderName 'config.json'

if (-not (Test-Path -Path $configFilePath)) {
New-Item -Path $configFilePath -ItemType File -Force | Out-Null
Set-StoreVariable -Name 'Name' -Value $Name
Set-StoreVariable -Name 'ConfigFileName' -Value $configFilePath
}

Restore-VariableStore -Name $Name
$script:Store = Get-Content -Path $configFilePath | ConvertFrom-Json

}
19 changes: 0 additions & 19 deletions src/Store/private/Restore-VariableStore.ps1

This file was deleted.

9 changes: 0 additions & 9 deletions src/Store/private/Save-VariableStore.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion src/Store/private/Set-StoreVariable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
} else {
$script:Store.$Name = $Value
}
Save-VariableStore
$script:Store | ConvertTo-Json | Set-Content -Path $script:Store.ConfigFileName -Force
}
}
2 changes: 1 addition & 1 deletion src/Store/public/Get-StoreConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

switch ($PSCmdlet.ParameterSetName) {
'Variable' {
Get-ConfigVariable -Name $VariableName
Get-StoreVariable -Name $VariableName
}
'Secret' {
Get-Secret -Name $SecretName -AsPlainText -Vault $script:Store.SecretVaultName
Expand Down
4 changes: 2 additions & 2 deletions src/Store/public/Set-StoreConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
DefaultParameterSetName = 'Variable'
)]
param (
# The variable name to set.
# The name of a variable to set.
[Parameter(
Mandatory,
ParameterSetName = 'Variable'
)]
[string] $VariableName,

# The SecretName to set.
# The name of a secret to set.
[Parameter(
Mandatory,
ParameterSetName = 'Secret'
Expand Down

0 comments on commit f6b9b2e

Please sign in to comment.