MCPcopy Index your code
hub / github.com/deepnote/deepnote / createCatAction

Function createCatAction

packages/cli/src/commands/cat.ts:43–64  ·  view source on GitHub ↗
(_program: Command)

Source from the content-addressed store, hash-verified

41}
42
43export function createCatAction(_program: Command): (path: string, options: CatOptions) => Promise<void> {
44 return async (path, options) => {
45 try {
46 debug(`Cat file: ${path}`)
47 debug(`Options: ${JSON.stringify(options)}`)
48 await catDeepnoteFile(path, options)
49 } catch (error) {
50 const message = error instanceof Error ? error.message : String(error)
51 // User input errors should return InvalidUsage (2)
52 const exitCode =
53 error instanceof FileResolutionError || error instanceof ParseError || error instanceof NotFoundInProjectError
54 ? ExitCode.InvalidUsage
55 : ExitCode.Error
56 if (options.output === 'json') {
57 outputJson({ success: false, error: message })
58 } else {
59 logError(message)
60 }
61 process.exit(exitCode)
62 }
63 }
64}
65
66async function catDeepnoteFile(path: string, options: CatOptions): Promise<void> {
67 const { absolutePath } = await resolvePathToDeepnoteFile(path)

Callers 2

registerCommandsFunction · 0.90
cat.test.tsFile · 0.90

Calls 3

debugFunction · 0.90
outputJsonFunction · 0.90
catDeepnoteFileFunction · 0.85

Tested by

no test coverage detected