Stub out Idv parser
This commit is contained in:
parent
a2df9a4142
commit
e90727a06c
4 changed files with 118 additions and 1 deletions
debug
43
debug/idv.ts
Normal file
43
debug/idv.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
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];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue