Show VM not running warning in list

This commit is contained in:
Chris Wanstrath 2026-02-27 07:31:45 -08:00
parent a193bf5cad
commit 661e6f3450
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,7 @@ import { homedir } from "os"
import * as git from "../git.ts" import * as git from "../git.ts"
import * as vm from "../vm.ts" import * as vm from "../vm.ts"
import * as state from "../state.ts" import * as state from "../state.ts"
import { reset, dim, bold, green, yellow, cyan, white } from "../fmt.ts" import { reset, dim, bold, green, yellow, cyan, white, red } from "../fmt.ts"
export async function action(opts: { json?: boolean }) { export async function action(opts: { json?: boolean }) {
const root = await git.repoRoot() const root = await git.repoRoot()
@ -37,6 +37,9 @@ export async function action(opts: { json?: boolean }) {
if (sessions.length === 0) { if (sessions.length === 0) {
console.log("◆ No active sessions.") console.log("◆ No active sessions.")
if ((await vm.status()) !== "running") {
console.log(`${red}VM is not running.${reset}`)
}
return return
} }
@ -77,4 +80,8 @@ export async function action(opts: { json?: boolean }) {
} }
console.log(`\n${dim}◯ idle${reset} · ${cyan}◎ active${reset} · ${yellow}◐ unsaved${reset} · ${green}● saved${reset}`) console.log(`\n${dim}◯ idle${reset} · ${cyan}◎ active${reset} · ${yellow}◐ unsaved${reset} · ${green}● saved${reset}`)
if ((await vm.status()) !== "running") {
console.log(`${red}VM is not running.${reset}`)
}
} }

View File

@ -4,6 +4,7 @@ export const reset = "\x1b[0m"
export const dim = "\x1b[2m" export const dim = "\x1b[2m"
export const green = "\x1b[32m" export const green = "\x1b[32m"
export const yellow = "\x1b[33m" export const yellow = "\x1b[33m"
export const red = "\x1b[31m"
export const cyan = "\x1b[36m" export const cyan = "\x1b[36m"
// ── Formatted output ──────────────────────────────────────────────── // ── Formatted output ────────────────────────────────────────────────