runandlog 0.3.1

CLI / TUI that runs the shell commands in a Markdown file and writes the results back
/* Window styling. Deliberately plain: this is a tool window, not a web page. */

:root {
  /* The page sits a shade behind the cards rather than level with them: with both
     white, a card was told from the page by its border alone and the document read
     as one flat sheet. */
  --bg: #e5e7eb;
  --card: #ffffff;
  --fg: #1f2328;
  --muted: #656d76;
  --border: #d0d7de;
  --surface: #f6f8fa;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --error: #cf222e;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Same relationship the other way round: the page is the darker of the two. */
    --bg: #010409;
    --card: #0d1117;
    --fg: #e6edf3;
    --muted: #8b949e;
    --border: #30363d;
    --surface: #161b22;
    --accent: #4493f8;
    --ok: #3fb950;
    --error: #f85149;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  /* No `direction: rtl` here, however tempting it is for keeping the end of a
     long path visible: it moves the leading slash of an absolute path to the
     other end, so /home/x/a.md is drawn as home/x/a.md/. The window title
     carries the file name anyway, and the full path is in the tooltip. */
}

.actions {
  display: flex;
  gap: 8px;
}

button {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.cells {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  margin-bottom: 14px;
  overflow: hidden;
}

.cell.running {
  border-color: var(--accent);
}

.cell-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.number {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  /* Fixed width so the buttons beside it line up whether the number is one digit
     or two, since the numbers carry no brackets to hold a shape of their own. */
  min-width: 1.6em;
  text-align: center;
}

.out {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}

pre {
  margin: 0;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.result {
  border-top: 1px dashed var(--border);
  background: var(--surface);
  color: var(--muted);
}

.empty {
  color: var(--muted);
}

.status {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}

.status[data-kind='ok'] {
  color: var(--ok);
}

.status[data-kind='error'] {
  color: var(--error);
}