From 5df12e27fb1cca270b1ee9fa77cf989ebb6ec018 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 15 Sep 2024 17:04:49 -0400 Subject: [PATCH] feat(update-script): add option to semd output to file --- apps/update/src/app.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/update/src/app.ts b/apps/update/src/app.ts index 82a4e058..9e258c6c 100644 --- a/apps/update/src/app.ts +++ b/apps/update/src/app.ts @@ -1,4 +1,5 @@ import { spawnSync } from 'node:child_process'; +import { writeFileSync } from 'node:fs'; import { parseArgs } from './lib.ts'; import { updateFirefoxAddons } from '././firefox.ts'; @@ -58,13 +59,20 @@ if (args['a'] || args['all']) { stdio: [process.stdin, process.stdout, process.stderr], }); - console.log([ + const output = [ 'chore: update flake.lock', `Flake Inputs:\n${flakeOutput}`, `Docker Images:\n${dockerOutput}`, `Firefox Addons:\n${firefoxOutput}`, `Misc Sources:\n${vuetorrentOutput}`, - ].join('\n\n')); + ].join('\n\n'); + + if (args['f']) { + writeFileSync(args['f'] as string, output); + } + else { + console.log(output); + } } spawnSync('alejandra', ['-q', FLAKE], { shell: true });