mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Add a bunch of shell tool commands
This commit is contained in:
19 files changed
+1710
-45
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import type { ShellCommand, ShellCommandResult } from "./ShellCommand";
|
||||
import { createSuccessResult } from "./ShellCommand";
|
||||
|
||||
/**
|
||||
* Implementation of the 'echo' command
|
||||
* Display text
|
||||
*/
|
||||
export class EchoCommand implements ShellCommand {
|
||||
name = 'echo';
|
||||
description = 'Display text';
|
||||
usage = 'echo [text...]';
|
||||
|
||||
async execute(args: string[], _cwd: string): Promise<ShellCommandResult> {
|
||||
// Join all arguments with spaces, like real echo
|
||||
const output = args.join(' ');
|
||||
|
||||
// echo always succeeds and adds a newline
|
||||
return createSuccessResult(output + '\n');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user