MCPcopy Create free account
hub / github.com/cloudflare/computer / runLsFiles

Function runLsFiles

packages/computer/src/git/cli.ts:996–1021  ·  view source on GitHub ↗
(
  client: GitClient,
  args: string[],
  input: GitCliInput,
)

Source from the content-addressed store, hash-verified

994// ---------------------------------------------------------------
995
996async function runLsFiles(
997 client: GitClient,
998 args: string[],
999 input: GitCliInput,
1000): Promise<GitCliResult> {
1001 const parsed = parseFlags(args, {
1002 ref: { kind: "value" },
1003 });
1004 if ("error" in parsed) {
1005 return { stdout: "", stderr: `git ls-files: ${parsed.error}\n`, exitCode: 129 };
1006 }
1007 if (parsed.positional.length > 0) {
1008 return {
1009 stdout: "",
1010 stderr: `git ls-files: unexpected argument '${parsed.positional[0]}'\n`,
1011 exitCode: 129,
1012 };
1013 }
1014 const dir = resolveDir(undefined, input.cwd);
1015 try {
1016 const files = await client.lsFiles({ dir, ref: parsed.flags.ref as string | undefined });
1017 return { stdout: files.length === 0 ? "" : `${files.join("\n")}\n`, stderr: "", exitCode: 0 };
1018 } catch (cause) {
1019 return mapGitError("ls-files", cause);
1020 }
1021}
1022
1023// ---------------------------------------------------------------
1024// ls-tree

Callers 1

runGitCliFunction · 0.85

Calls 4

resolveDirFunction · 0.85
mapGitErrorFunction · 0.85
lsFilesMethod · 0.80
parseFlagsFunction · 0.70

Tested by

no test coverage detected