-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[manifest] Present new Out-Manifest and Get-Manifest function #3332
Conversation
Why not use |
Because i want to extend that funtion get-manifest to something like this: function Get-M {
switch (-regex $extensionOfFile) {
'ya?ml' {
$man = parse_yml
}
default {
$man = parse_json
}
}
return $man
} |
https://github.com/Ash258/scoop/blob/35af9a326aa6c542f75407f2ea7ca02e11b37634/lib/manifest.ps1#L59-L70 |
Maybe as follow: function parse_json {
Get-Manifest ...
}
function Get-Manifest (..., [Switch]$XML) {
if ($XML) {
...
} else {
...
}
} |
I do not want to add switch parameter. I will add yaml support and someone could add toml support, so new parameter need to be set, which is not good. I rather put filepath and then determine file type and execute correct parsing function. |
Maybe move |
And a new |
Exactly. |
Validate parameters to not be null or empty
First part of YAML manifests support.
These wrapper functions will help with integrating new manifest types and make code a bit cleaner.
#2715