Add a command-line cline powered by deno

This commit is contained in:
Matt Rubens
2024-11-20 23:21:38 -05:00
parent e55696e247
commit 1c471bd3cb
12 changed files with 1103 additions and 0 deletions

40
cli/deno.d.ts vendored Normal file
View File

@@ -0,0 +1,40 @@
declare namespace Deno {
export const args: string[];
export function exit(code?: number): never;
export const env: {
get(key: string): string | undefined;
};
export function cwd(): string;
export function readTextFile(path: string): Promise<string>;
export function writeTextFile(path: string, data: string): Promise<void>;
export function mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;
export function readDir(path: string): AsyncIterable<{
name: string;
isFile: boolean;
isDirectory: boolean;
}>;
export function stat(path: string): Promise<{
isFile: boolean;
isDirectory: boolean;
}>;
export class Command {
constructor(cmd: string, options?: {
args?: string[];
stdout?: "piped";
stderr?: "piped";
});
output(): Promise<{
stdout: Uint8Array;
stderr: Uint8Array;
}>;
}
export const permissions: {
query(desc: { name: string; path?: string }): Promise<{ state: "granted" | "denied" }>;
};
export const errors: {
PermissionDenied: typeof Error;
};
export const stdout: {
write(data: Uint8Array): Promise<number>;
};
}