mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
20 lines
603 B
TypeScript
20 lines
603 B
TypeScript
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, _input?: 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');
|
|
}
|
|
} |