From 76bd1ad784ca7573f222cc76125861aad81c1458 Mon Sep 17 00:00:00 2001 From: Siddharth Singh Date: Mon, 30 Sep 2024 11:16:15 +0530 Subject: [PATCH] add runLocally, add required opt for Option --- tribes-cli/utils/mod.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tribes-cli/utils/mod.ts b/tribes-cli/utils/mod.ts index 15927034..a9dd1951 100644 --- a/tribes-cli/utils/mod.ts +++ b/tribes-cli/utils/mod.ts @@ -1,10 +1,10 @@ -import { ParsedArgs } from './parsing.ts'; +import { getOptionName, ParsedArgs } from './parsing.ts'; import { Command } from './command.ts'; import { defaultIdentityFile } from './ssh/identity.ts'; -import { connect } from './ssh/mod.ts'; +import { makeSshAction, privkeyToPubkey } from './ssh/mod.ts'; export type Option = - & { description: string } + & { description: string; required?: true } & ({ default?: string; } | { @@ -16,5 +16,14 @@ export const cleanArg = (arg: string) => { return arg.replace(/^--?/g, ''); }; -export { Command, connect, defaultIdentityFile }; +export async function runLocally(cmd: string) { + console.log(cmd); + const command = new Deno.Command('bash', { + args: ['-c', cmd], + }); + + return command.output(); +} + +export { Command, defaultIdentityFile, getOptionName, makeSshAction, privkeyToPubkey }; export type { ParsedArgs };