function pathBeingTyped
pathBeingTyped(line: string): string | null

The path being typed on a .cat or .view line, or null on any other line.

What decides whether a completion is a filename or an expression — and null is the signal to go and ask the page instead. A path with a space in it is not completable here, which is the same bargain a dot command already makes with its argument.

import { pathBeingTyped } from './completion.ts';

pathBeingTyped('.cat lib/re'); // 'lib/re'
pathBeingTyped('.view '); // '' — everything in the working directory
pathBeingTyped('document.ti'); // null — an expression, not a path

Parameters

line: string

Return Type

string | null

Usage

import { pathBeingTyped } from "lib/commands/repl/completion.ts";