Skip to content
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

Closed
wants to merge 13 commits into from

Conversation

Ash258
Copy link
Contributor

@Ash258 Ash258 commented Apr 18, 2019

First part of YAML manifests support.

These wrapper functions will help with integrating new manifest types and make code a bit cleaner.

#2715

@niheaven
Copy link
Member

Why not use parse_json as warpper function of Get-Manifest so parse_json could be deleted after no reference exist?

@Ash258
Copy link
Contributor Author

Ash258 commented Apr 18, 2019

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
}

@Ash258
Copy link
Contributor Author

Ash258 commented Apr 18, 2019

https://github.com/Ash258/scoop/blob/35af9a326aa6c542f75407f2ea7ca02e11b37634/lib/manifest.ps1#L59-L70
This is old implementation which i will port to use switch maybe

@niheaven
Copy link
Member

Maybe as follow:

function parse_json {
    Get-Manifest ...
}
function Get-Manifest (..., [Switch]$XML) {
    if ($XML) {
        ...
    } else {
        ...
    }
}

@Ash258
Copy link
Contributor Author

Ash258 commented Apr 18, 2019

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.

@Ash258
Copy link
Contributor Author

Ash258 commented Apr 18, 2019

Maybe move parse_json into lib\json.ps1? 🤔

@niheaven
Copy link
Member

And a new xml.ps1

@Ash258
Copy link
Contributor Author

Ash258 commented Apr 18, 2019

Exactly.
Try to move towards strict and more divergent /independent modules.

@Ash258 Ash258 mentioned this pull request Jul 18, 2019
71 tasks
@Ash258 Ash258 changed the base branch from master to develop July 27, 2019 20:55
@Ash258 Ash258 closed this Jul 9, 2020
@Ash258 Ash258 deleted the Yaml-Wave1 branch December 19, 2020 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants