add runLocally, add required opt for Option

This commit is contained in:
Siddharth Singh 2024-09-30 11:16:15 +05:30
parent b4f8cd894f
commit 76bd1ad784
No known key found for this signature in database

View file

@ -1,10 +1,10 @@
import { ParsedArgs } from './parsing.ts'; import { getOptionName, ParsedArgs } from './parsing.ts';
import { Command } from './command.ts'; import { Command } from './command.ts';
import { defaultIdentityFile } from './ssh/identity.ts'; import { defaultIdentityFile } from './ssh/identity.ts';
import { connect } from './ssh/mod.ts'; import { makeSshAction, privkeyToPubkey } from './ssh/mod.ts';
export type Option = export type Option =
& { description: string } & { description: string; required?: true }
& ({ & ({
default?: string; default?: string;
} | { } | {
@ -16,5 +16,14 @@ export const cleanArg = (arg: string) => {
return arg.replace(/^--?/g, ''); 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 }; export type { ParsedArgs };