refactor(daemon-cli): share status text styling
This commit is contained in:
@@ -7,12 +7,26 @@ import { resolveGatewayLogPaths } from "../../daemon/launchd.js";
|
||||
import { formatRuntimeStatus } from "../../daemon/runtime-format.js";
|
||||
import { pickPrimaryLanIPv4 } from "../../gateway/net.js";
|
||||
import { getResolvedLoggerSettings } from "../../logging.js";
|
||||
import { colorize, isRich, theme } from "../../terminal/theme.js";
|
||||
import { formatCliCommand } from "../command-format.js";
|
||||
import { parsePort } from "../shared/parse-port.js";
|
||||
|
||||
export { formatRuntimeStatus };
|
||||
export { parsePort };
|
||||
|
||||
export function createCliStatusTextStyles() {
|
||||
const rich = isRich();
|
||||
return {
|
||||
rich,
|
||||
label: (value: string) => colorize(rich, theme.muted, value),
|
||||
accent: (value: string) => colorize(rich, theme.accent, value),
|
||||
infoText: (value: string) => colorize(rich, theme.info, value),
|
||||
okText: (value: string) => colorize(rich, theme.success, value),
|
||||
warnText: (value: string) => colorize(rich, theme.warn, value),
|
||||
errorText: (value: string) => colorize(rich, theme.error, value),
|
||||
};
|
||||
}
|
||||
|
||||
export function parsePortFromArgs(programArguments: string[] | undefined): number | null {
|
||||
if (!programArguments?.length) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user