Last active
December 8, 2021 19:17
-
-
Save nullbytepl/9777f44aeb0b032bc95890f72ca21bd7 to your computer and use it in GitHub Desktop.
RFC for next-gen dumpyara. Suggest features and changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const main = [ | |
| { | |
| id: 'Entry validator', | |
| type: 'fence', | |
| validator: entryValidator, | |
| onFail: 'exit', | |
| }, | |
| { | |
| id: 'Extraction sub-pipeline', | |
| type: 'subpipeline', | |
| intermediates: 'extracted', | |
| pipeline: extract, | |
| }, | |
| { | |
| id: 'Validate that we have unpackaged files at this point', | |
| type: 'fence', | |
| validator: unpackagedExist, | |
| onFail: 'exit', | |
| }, | |
| // {...} | |
| ]; | |
| const extract = [ | |
| { | |
| id: 'Extract basic zips', | |
| type: 'step', | |
| execute: extractZip, | |
| condition: api => api.input[0].endsWith('.zip'), | |
| onSuccess: 'returnFromSubpipeline', | |
| }, | |
| { | |
| id: 'Fallthrough, extraction not supported', | |
| type: 'fail', | |
| }, | |
| ]; | |
| function entryValidator(api) { | |
| // must be one file, zip | |
| return (api.input.length == 1 && api.input[0].endsWith('.zip')); | |
| } | |
| function extractZip(api) { | |
| // from the input file to intermediate dir for the current step | |
| return utils.extract7z(api.input[0], api.intermediates[api.currentIntermediates]); | |
| } | |
| function unpackagedExist(api) { | |
| // at least 3 files must exist | |
| return api.intermediates[api.previousIntermediates] && api.intermediates[api.previousIntermediates].length > 2; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment