Skip to content

Commit

Permalink
scripts: tune rimpl poc to support input and output
Browse files Browse the repository at this point in the history
 args.
  • Loading branch information
narekhovhannisyan committed Aug 30, 2023
1 parent ff56d42 commit 6a6ba87
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/rimpl-poc.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import {parseProcessArgument} from '../src/util/args';
import {openYamlFileAsObject} from '../src/util/yaml';
import {openYamlFileAsObject, saveYamlFileAs} from '../src/util/yaml';

/**
* 1. Parses process argument.
* 2. Opens yaml file as an object.
* @todo Apply logic here.
* @example run following command `npx ts-node scripts/rimpl-poc/ts ./test.yml`
* @example run following command `npx ts-node scripts/rimpl-poc.ts --impl ./test.yml --ompl ./result.yml`
*/
const rimplPOCScript = async () => {
try {
const yamlPath = parseProcessArgument();
const impl = await openYamlFileAsObject(yamlPath);
const {inputPath, outputPath} = parseProcessArgument();

console.log(`Check object here: ${impl}`);
const impl = await openYamlFileAsObject(inputPath);

if (!outputPath) {
console.log(JSON.stringify(impl));
return;
}

saveYamlFileAs(impl, outputPath);
} catch (error) {
console.error(error);
}
Expand Down

0 comments on commit 6a6ba87

Please sign in to comment.