mirror of
https://github.com/morten-olsen/http.md.git
synced 2026-02-08 00:46:28 +01:00
refact: ink based terminal view (#17)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { dirname, resolve } from 'path';
|
||||
import { toString } from 'mdast-util-to-string'
|
||||
import { execute, type ExecutionHandler } from '../execution.js';
|
||||
import { FileNotFoundError } from '../../utils/errors.js';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
const fileHandler: ExecutionHandler = ({
|
||||
addStep,
|
||||
@@ -18,8 +20,8 @@ const fileHandler: ExecutionHandler = ({
|
||||
dirname(file),
|
||||
toString(node)
|
||||
);
|
||||
if (!filePath) {
|
||||
throw new Error('File path is required');
|
||||
if (!existsSync(filePath)) {
|
||||
throw new FileNotFoundError(filePath);
|
||||
}
|
||||
const { root: newRoot } = await execute(filePath, {
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user