import { h } from "../lib/html"; import { Idv, StringFromDocument } from "../lib/idv"; export function IdvDebug() { const textarea = h( "textarea", { cols: 80, rows: 40, oninput(ev) { parse(); }, }, `# Idv Testing Ground Uid: 0 Shell: tclsh Group: users Group: sudo ` ); const pre = h("pre"); function parse() { try { const idv = Idv.parse(textarea.value); pre.textContent = JSON.stringify( { shell: idv.getProperty("Shell", String, StringFromDocument), groups: idv.getList("Group", String, StringFromDocument), }, null, 2 ); } catch (e) { pre.textContent = String(e); } } parse(); return [textarea, pre]; }