mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
21 lines
642 B
TypeScript
21 lines
642 B
TypeScript
import type { ShellCommand, ShellCommandResult } from "./ShellCommand";
|
|
import { createSuccessResult, createErrorResult } from "./ShellCommand";
|
|
|
|
/**
|
|
* Implementation of the 'pwd' command
|
|
* Print working directory
|
|
*/
|
|
export class PwdCommand implements ShellCommand {
|
|
name = 'pwd';
|
|
description = 'Print working directory';
|
|
usage = 'pwd';
|
|
|
|
async execute(args: string[], cwd: string, _input?: string): Promise<ShellCommandResult> {
|
|
// pwd doesn't accept any arguments in standard Linux
|
|
if (args.length > 0) {
|
|
return createErrorResult(`${this.name}: too many arguments`);
|
|
}
|
|
|
|
return createSuccessResult(cwd);
|
|
}
|
|
} |