diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/README.md | 58 | ||||
| -rw-r--r-- | web/assets/css/chroma.css | 83 | ||||
| -rw-r--r-- | web/assets/css/zash.css | 672 | ||||
| -rw-r--r-- | web/assets/js/copy.js | 16 | ||||
| -rw-r--r-- | web/content/_index.md | 74 | ||||
| -rw-r--r-- | web/content/docs/_index.md | 7 | ||||
| -rw-r--r-- | web/content/docs/develop.md | 46 | ||||
| -rw-r--r-- | web/content/docs/install.md | 62 | ||||
| -rw-r--r-- | web/content/docs/status.md | 40 | ||||
| -rw-r--r-- | web/hugo.toml | 37 | ||||
| -rw-r--r-- | web/layouts/404.html | 7 | ||||
| -rw-r--r-- | web/layouts/baseof.html | 46 | ||||
| -rw-r--r-- | web/layouts/home.html | 41 | ||||
| -rw-r--r-- | web/layouts/list.html | 27 | ||||
| -rw-r--r-- | web/layouts/partials/docs-nav.html | 16 | ||||
| -rw-r--r-- | web/layouts/partials/head.html | 26 | ||||
| -rw-r--r-- | web/layouts/single.html | 23 | ||||
| -rw-r--r-- | web/static/zash-logo.svg | 25 |
18 files changed, 1306 insertions, 0 deletions
diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000..3b5fadc --- /dev/null +++ b/web/README.md @@ -0,0 +1,58 @@ +# web + +The zash website: a Hugo site in the project's `web/` directory, building to +`web/public/`. Nothing is generated into the repository, and Hugo itself is +not a build dependency of the shell. + +## Local preview + +```sh +hugo server --source web # http://localhost:1313/ +hugo --source web --minify # -> web/public/ +``` + +Hugo is a single Go binary; `go install github.com/gohugoio/hugo@latest` or a +release tarball from github.com/gohugoio/hugo/releases both do. No theme +module is used, so the site builds with no network access. + +## Layout + +``` +web/ + hugo.toml baseURL, title, menu, highlight style + content/ + _index.md home page + docs/ the documentation pages, ordered by weight + layouts/ + baseof.html shell of every page + home.html hero and the terminal card + single.html a docs page, with the sidebar + list.html a section index + 404.html + partials/ head, docs-nav + assets/ + css/zash.css the design + css/chroma.css `hugo gen chromastyles --style=tokyonight-night` + js/copy.js copy buttons on code blocks, optional + static/ the logo +``` + +No theme module is used: the CSS is a few hundred lines, and the palette comes +from `packaging/zash-logo.svg` - mainframe navy, periwinkle and a signal blue. +The site is dark only, on purpose. + +The code blocks are highlighted with classes rather than inline styles +(`markup.highlight.noClasses = false`), so `assets/css/chroma.css` has to match +the `style` in `hugo.toml`. Regenerate both together: + +```sh +hugo gen chromastyles --style=tokyonight-night > web/assets/css/chroma.css +``` + +## Publishing + +There is no deploy workflow yet: zash is a private repository and GitHub Pages +is not available for one on a free plan. The options when it comes to +publishing are a public repository, a paid plan with Pages enabled for this +one, or a separate public repository that carries only `web/` and its +workflow. diff --git a/web/assets/css/chroma.css b/web/assets/css/chroma.css new file mode 100644 index 0000000..ffa55a8 --- /dev/null +++ b/web/assets/css/chroma.css @@ -0,0 +1,83 @@ +/* Generated using: hugo gen chromastyles --style=tokyonight-night */ + +/* Background */ .bg { color:#c0caf5;background-color:#1a1b26; } +/* PreWrapper */ .chroma { color:#c0caf5;background-color:#1a1b26;-webkit-text-size-adjust:none; } +/* Other */ .chroma .x { color:#c0caf5 } +/* Error */ .chroma .err { color:#db4b4b } +/* CodeLine */ .chroma .cl { color:#c0caf5 } +/* LineLink */ .chroma .lnlinks { outline:none;text-decoration:none;color:inherit } +/* LineTableTD */ .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; } +/* LineTable */ .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; } +/* LineHighlight */ .chroma .hl { background-color:#414868 } +/* LineNumbersTable */ .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#a9b1d6 } +/* LineNumbers */ .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#a9b1d6 } +/* Line */ .chroma .line { display:flex; } +/* Keyword */ .chroma .k { color:#bb9af7 } +/* KeywordConstant */ .chroma .kc { color:#e0af68 } +/* KeywordDeclaration */ .chroma .kd { color:#9d7cd8 } +/* KeywordNamespace */ .chroma .kn { color:#7dcfff } +/* KeywordPseudo */ .chroma .kp { color:#bb9af7 } +/* KeywordReserved */ .chroma .kr { color:#bb9af7 } +/* KeywordType */ .chroma .kt { color:#41a6b5 } +/* NameAttribute */ .chroma .na { color:#7aa2f7 } +/* NameClass */ .chroma .nc { color:#ff9e64 } +/* NameConstant */ .chroma .no { color:#ff9e64 } +/* NameDecorator */ .chroma .nd { color:#7aa2f7;font-weight:bold } +/* NameEntity */ .chroma .ni { color:#7dcfff } +/* NameException */ .chroma .ne { color:#e0af68 } +/* NameLabel */ .chroma .nl { color:#9ece6a } +/* NameNamespace */ .chroma .nn { color:#e0af68 } +/* NameOther */ .chroma .nx { color:#c0caf5 } +/* NameProperty */ .chroma .py { color:#e0af68 } +/* NameTag */ .chroma .nt { color:#bb9af7 } +/* NameBuiltin */ .chroma .nb { color:#9ece6a } +/* NameBuiltinPseudo */ .chroma .bp { color:#9ece6a } +/* NameVariableClass */ .chroma .vc { color:#c0caf5 } +/* NameVariableGlobal */ .chroma .vg { color:#c0caf5 } +/* NameVariableInstance */ .chroma .vi { color:#c0caf5 } +/* NameVariableMagic */ .chroma .vm { color:#c0caf5 } +/* NameFunction */ .chroma .nf { color:#7aa2f7 } +/* NameFunctionMagic */ .chroma .fm { color:#7aa2f7 } +/* LiteralDate */ .chroma .ld { color:#c0caf5 } +/* LiteralString */ .chroma .s { color:#9ece6a } +/* LiteralStringAffix */ .chroma .sa { color:#9d7cd8 } +/* LiteralStringBacktick */ .chroma .sb { color:#9ece6a } +/* LiteralStringChar */ .chroma .sc { color:#9ece6a } +/* LiteralStringDelimiter */ .chroma .dl { color:#7aa2f7 } +/* LiteralStringDoc */ .chroma .sd { color:#414868 } +/* LiteralStringDouble */ .chroma .s2 { color:#9ece6a } +/* LiteralStringEscape */ .chroma .se { color:#7aa2f7 } +/* LiteralStringHeredoc */ .chroma .sh { color:#414868 } +/* LiteralStringInterpol */ .chroma .si { color:#9ece6a } +/* LiteralStringOther */ .chroma .sx { color:#9ece6a } +/* LiteralStringRegex */ .chroma .sr { color:#7dcfff } +/* LiteralStringSingle */ .chroma .s1 { color:#9ece6a } +/* LiteralStringSymbol */ .chroma .ss { color:#9ece6a } +/* LiteralNumber */ .chroma .m { color:#e0af68 } +/* LiteralNumberBin */ .chroma .mb { color:#e0af68 } +/* LiteralNumberFloat */ .chroma .mf { color:#e0af68 } +/* LiteralNumberHex */ .chroma .mh { color:#e0af68 } +/* LiteralNumberInteger */ .chroma .mi { color:#e0af68 } +/* LiteralNumberIntegerLong */ .chroma .il { color:#e0af68 } +/* LiteralNumberOct */ .chroma .mo { color:#e0af68 } +/* Operator */ .chroma .o { color:#9ece6a;font-weight:bold } +/* OperatorWord */ .chroma .ow { color:#9ece6a;font-weight:bold } +/* OperatorReserved */ .chroma .or { color:#9ece6a;font-weight:bold } +/* Comment */ .chroma .c { color:#414868;font-style:italic } +/* CommentHashbang */ .chroma .ch { color:#414868;font-style:italic } +/* CommentMultiline */ .chroma .cm { color:#414868;font-style:italic } +/* CommentSingle */ .chroma .c1 { color:#414868;font-style:italic } +/* CommentSpecial */ .chroma .cs { color:#414868;font-style:italic } +/* CommentPreproc */ .chroma .cp { color:#414868;font-style:italic } +/* CommentPreprocFile */ .chroma .cpf { color:#414868;font-weight:bold;font-style:italic } +/* GenericDeleted */ .chroma .gd { color:#db4b4b;background-color:#15161e } +/* GenericEmph */ .chroma .ge { font-style:italic } +/* GenericError */ .chroma .gr { color:#db4b4b } +/* GenericHeading */ .chroma .gh { color:#e0af68;font-weight:bold } +/* GenericInserted */ .chroma .gi { color:#9ece6a;background-color:#15161e } +/* GenericOutput */ .chroma .go { color:#c0caf5 } +/* GenericPrompt */ .chroma .gp { color:#c0caf5 } +/* GenericStrong */ .chroma .gs { font-weight:bold } +/* GenericSubheading */ .chroma .gu { color:#e0af68;font-weight:bold } +/* GenericTraceback */ .chroma .gt { color:#db4b4b } +/* GenericUnderline */ .chroma .gl { text-decoration:underline } diff --git a/web/assets/css/zash.css b/web/assets/css/zash.css new file mode 100644 index 0000000..24f8f6a --- /dev/null +++ b/web/assets/css/zash.css @@ -0,0 +1,672 @@ +/* zash - palette from the logo: mainframe navy, periwinkle, signal blue. */ + +:root { + color-scheme: dark; + + --bg: #0b0e17; + --panel: #101728; + --panel-2: #16213f; + --line: #222e4c; + --line-soft: #1a2438; + --fg: #d9e2f7; + --muted: #8fa6d9; + --accent: #5b86ff; + --accent-soft: #1b2b57; + --ok: #6ee7a8; + --warn: #ffcc66; + + --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, + monospace; + --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", + sans-serif; + --radius: 10px; + --wrap: 68rem; +} + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + scroll-behavior: smooth; + scroll-padding-top: 5rem; +} + +body { + margin: 0; + background: + radial-gradient(75rem 40rem at 50% -18rem, #16214a 0%, transparent 70%), + var(--bg); + color: var(--fg); + font: 17px/1.65 var(--sans); + -webkit-font-smoothing: antialiased; +} + +a { + color: var(--accent); + text-decoration-thickness: 1px; + text-underline-offset: 2px; +} + +a:hover { + color: #8fb0ff; +} + +:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 3px; + border-radius: 4px; +} + +.skip { + position: absolute; + left: -999px; +} + +.skip:focus { + left: 1rem; + top: 1rem; + z-index: 10; + padding: .5rem .75rem; + background: var(--panel-2); + border-radius: var(--radius); +} + +/* ---------------------------------------------------------------- chrome */ + +.wrap { + width: 100%; + max-width: var(--wrap); + margin: 0 auto; + padding: 0 1.5rem; +} + +header.site { + position: sticky; + top: 0; + z-index: 5; + backdrop-filter: blur(10px); + background: color-mix(in srgb, var(--bg) 82%, transparent); + border-bottom: 1px solid var(--line-soft); +} + +header.site .bar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1.5rem; + max-width: var(--wrap); + margin: 0 auto; + padding: .7rem 1.5rem; +} + +header.site .brand { + display: flex; + align-items: center; + gap: .6rem; + color: var(--fg); + font: 600 1.15rem/1 var(--mono); + letter-spacing: .02em; + text-decoration: none; +} + +header.site .brand img { + width: 30px; + height: 30px; + border-radius: 6px; +} + +header.site nav { + display: flex; + align-items: center; + gap: 1.25rem; + font-size: .95rem; +} + +header.site nav a { + color: var(--muted); + text-decoration: none; +} + +header.site nav a:hover, +header.site nav a[aria-current="page"] { + color: var(--fg); +} + +footer.site { + margin-top: 5rem; + border-top: 1px solid var(--line-soft); + padding: 2rem 1.5rem 3rem; + color: var(--muted); + font-size: .92rem; +} + +footer.site .cols { + display: flex; + flex-wrap: wrap; + gap: 1rem 2rem; + align-items: baseline; + justify-content: space-between; + max-width: var(--wrap); + margin: 0 auto; +} + +footer.site p { + margin: 0; +} + +/* ------------------------------------------------------------------ home */ + +.hero { + display: grid; + grid-template-columns: 1.05fr .95fr; + gap: 3rem; + align-items: center; + padding: 4.5rem 1.5rem 3rem; + max-width: var(--wrap); + margin: 0 auto; +} + +.hero h1 { + margin: 0 0 .75rem; + font: 700 clamp(3rem, 7vw, 4.5rem)/1 var(--mono); + letter-spacing: -.03em; +} + +.hero h1 .prompt { + color: var(--accent); +} + +.lede { + margin: 0 0 1.5rem; + font-size: 1.18rem; + color: var(--muted); + max-width: 34rem; +} + +.actions { + display: flex; + flex-wrap: wrap; + gap: .75rem; + margin-bottom: 1.5rem; +} + +.btn { + display: inline-flex; + align-items: center; + gap: .5rem; + padding: .6rem 1rem; + border-radius: 8px; + border: 1px solid var(--line); + background: var(--panel); + color: var(--fg); + font: 500 .95rem/1 var(--sans); + text-decoration: none; +} + +.btn:hover { + border-color: var(--accent); + color: var(--fg); +} + +.btn.primary { + background: var(--accent); + border-color: var(--accent); + color: #08101f; + font-weight: 600; +} + +.btn.primary:hover { + background: #7aa0ff; + color: #08101f; +} + +.badges { + display: flex; + flex-wrap: wrap; + gap: .6rem; + font: .8rem/1 var(--mono); + color: var(--muted); +} + +.badges span { + border: 1px solid var(--line); + border-radius: 100px; + padding: .35rem .7rem; +} + +/* terminal card */ + +.term { + border: 1px solid var(--line); + border-radius: var(--radius); + background: linear-gradient(180deg, #0e1526, #0a0e18); + box-shadow: 0 24px 60px -30px #000, 0 0 0 1px #ffffff08 inset; + overflow: hidden; +} + +.term-bar { + display: flex; + align-items: center; + gap: .45rem; + padding: .6rem .8rem; + border-bottom: 1px solid var(--line-soft); + background: #0d1422; +} + +.term-bar .dot { + width: 10px; + height: 10px; + border-radius: 50%; + background: #2b3a5e; +} + +.term-bar .title { + margin-left: auto; + font: 400 .78rem/1 var(--mono); + color: var(--muted); +} + +.term pre { + margin: 0; + padding: 1.1rem 1.2rem 1.3rem; + white-space: pre; + overflow-x: auto; + font: .84rem/1.7 var(--mono); + background: none; +} + +.term .cmd::before { + content: "$ "; + color: var(--ok); +} + +.term .out { + color: var(--muted); +} + +.term .ok { + color: var(--ok); +} + +.term .cursor { + display: inline-block; + width: .55em; + height: 1.05em; + margin-left: .15em; + vertical-align: -.15em; + background: var(--accent); + animation: blink 1.1s steps(1) infinite; +} + +@keyframes blink { + 50% { + opacity: 0; + } +} + +@media (prefers-reduced-motion: reduce) { + .term .cursor { + animation: none; + } +} + +/* ---------------------------------------------------------------- article */ + +article { + max-width: 44rem; + margin: 0 auto; + padding: 3rem 1.5rem 0; +} + +article h1, +.docs-head h1 { + margin: 0 0 .4rem; + font: 700 clamp(1.9rem, 4vw, 2.5rem)/1.15 var(--sans); + letter-spacing: -.02em; +} + +article h2 { + margin: 3rem 0 .75rem; + font: 600 1.35rem/1.3 var(--sans); +} + +article h3 { + margin: 2rem 0 .5rem; + font: 600 1.08rem/1.35 var(--sans); +} + +article h2::before { + content: "# "; + color: var(--accent); + font-family: var(--mono); + opacity: .75; +} + +article ul, +article ol { + padding-left: 1.2rem; +} + +article li { + margin: .35rem 0; +} + +article hr { + border: 0; + border-top: 1px solid var(--line-soft); + margin: 3rem 0; +} + +article .term { + margin: 1.5rem 0; +} + +.edit { + margin: 3rem 0 0; + padding-top: 1.5rem; + border-top: 1px solid var(--line-soft); + font-size: .88rem; + color: var(--muted); +} + +/* --------------------------------------------------------------- features */ + +.feature-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); + gap: 1rem; + margin: 2rem 0 3rem; + max-width: var(--wrap); +} + +.card { + border: 1px solid var(--line); + border-radius: var(--radius); + background: linear-gradient(180deg, var(--panel), #0c1220); + padding: 1.25rem; +} + +.card h3 { + margin: 0 0 .4rem; + font: 600 1rem/1.2 var(--mono); + color: var(--fg); +} + +.card p { + margin: 0; + color: var(--muted); + font-size: .95rem; +} + +.card .tag { + display: inline-block; + margin-bottom: .6rem; + font: .7rem/1 var(--mono); + letter-spacing: .08em; + text-transform: uppercase; + color: var(--accent); +} + +/* ------------------------------------------------------------------- docs */ + +.docs { + display: grid; + grid-template-columns: 15rem minmax(0, 1fr); + gap: 3rem; + max-width: var(--wrap); + margin: 0 auto; + padding: 2.5rem 1.5rem 0; +} + +.docs aside { + font-size: .92rem; +} + +.docs aside .group { + margin: 0 0 1.75rem; +} + +.docs aside h2 { + margin: 0 0 .5rem; + font: .72rem/1 var(--mono); + letter-spacing: .1em; + text-transform: uppercase; + color: var(--muted); +} + +.docs aside a { + display: block; + padding: .3rem .6rem; + border-radius: 6px; + color: var(--muted); + text-decoration: none; +} + +.docs aside a:hover { + color: var(--fg); + background: var(--panel); +} + +.docs aside a[aria-current="page"] { + color: var(--fg); + background: var(--accent-soft); + box-shadow: inset 2px 0 0 var(--accent); +} + +.docs article { + max-width: 46rem; + margin: 0; + padding: 0; +} + +.docs-head { + padding-bottom: 1.5rem; + border-bottom: 1px solid var(--line-soft); + margin-bottom: 2rem; +} + +.docs-head .kicker { + font: .78rem/1 var(--mono); + letter-spacing: .08em; + text-transform: uppercase; + color: var(--accent); +} + +/* ------------------------------------------------------------ code & data */ + +code, +pre, +kbd { + font-family: var(--mono); +} + +:not(pre) > code { + padding: .12em .38em; + border: 1px solid var(--line-soft); + border-radius: 5px; + background: #121a2c; + font-size: .88em; + color: #cfe0ff; +} + +pre { + position: relative; + margin: 1.25rem 0; + padding: .95rem 1.1rem; + border: 1px solid var(--line-soft); + border-radius: var(--radius); + background: #0c1220; + overflow-x: auto; + font-size: .88rem; + line-height: 1.65; +} + +pre code { + background: none; + padding: 0; + border: 0; +} + +.chroma { + background: none !important; +} + +.copy { + position: absolute; + top: .5rem; + right: .5rem; + padding: .25rem .5rem; + border: 1px solid var(--line); + border-radius: 6px; + background: #0e1626; + color: var(--muted); + font: .72rem/1 var(--mono); + cursor: pointer; + opacity: 0; + transition: opacity .15s; +} + +pre:hover .copy, +.copy:focus-visible { + opacity: 1; +} + +.copy:hover { + color: var(--fg); + border-color: var(--accent); +} + +table { + width: 100%; + margin: 1.5rem 0; + border-collapse: collapse; + font-size: .92rem; +} + +th, +td { + padding: .5rem .7rem; + border-bottom: 1px solid var(--line-soft); + text-align: left; +} + +thead th { + font: .78rem/1.2 var(--mono); + letter-spacing: .04em; + text-transform: uppercase; + color: var(--muted); + border-bottom-color: var(--line); +} + +tbody tr:hover { + background: #0f1626; +} + +td:not(:first-child), +th:not(:first-child) { + text-align: right; + font-variant-numeric: tabular-nums; +} + +blockquote { + margin: 1.5rem 0; + padding: .25rem 0 .25rem 1rem; + border-left: 3px solid var(--accent-soft); + color: var(--muted); +} + +/* ------------------------------------------------------------------- list */ + +.pages { + list-style: none; + padding: 0; + margin: 2rem 0 0; +} + +.pages li { + border-bottom: 1px solid var(--line-soft); +} + +.pages a { + display: block; + padding: 1rem 0; + font-weight: 600; + text-decoration: none; + color: var(--fg); +} + +.pages a:hover { + color: var(--accent); +} + +.pages .summary { + display: block; + margin-top: .2rem; + color: var(--muted); + font-weight: 400; + font-size: .94rem; +} + +/* ------------------------------------------------------------------ 404 */ + +.notfound { + max-width: var(--wrap); + margin: 0 auto; + padding: 6rem 1.5rem; + text-align: center; +} + +.notfound h1 { + font: 700 clamp(3rem, 10vw, 5rem)/1 var(--mono); + margin: 0 0 1rem; + color: var(--accent); +} + +/* ------------------------------------------------------------------ small */ + +@media (max-width: 60rem) { + .hero { + grid-template-columns: 1fr; + gap: 2rem; + padding-top: 3rem; + } + + .docs { + grid-template-columns: 1fr; + gap: 1.5rem; + } + + .docs aside { + border-bottom: 1px solid var(--line-soft); + padding-bottom: .5rem; + } +} + +@media (max-width: 36rem) { + header.site .bar { + padding: .6rem 1rem; + } + + header.site nav { + gap: .9rem; + font-size: .9rem; + } + + .wrap, + .hero, + .docs, + article { + padding-left: 1rem; + padding-right: 1rem; + } + + /* The terminal wraps rather than scrolling under a phone's width. */ + .term pre { + white-space: pre-wrap; + overflow-wrap: anywhere; + font-size: .8rem; + } +} diff --git a/web/assets/js/copy.js b/web/assets/js/copy.js new file mode 100644 index 0000000..b846048 --- /dev/null +++ b/web/assets/js/copy.js @@ -0,0 +1,16 @@ +// Copy buttons on code blocks. The site works without this file. +document.querySelectorAll("article pre").forEach((pre) => { + const button = document.createElement("button"); + button.className = "copy"; + button.type = "button"; + button.textContent = "copy"; + button.addEventListener("click", () => { + const text = pre.querySelector("code")?.textContent ?? pre.textContent; + navigator.clipboard.writeText(text).then( + () => { button.textContent = "copied"; }, + () => { button.textContent = "failed"; }, + ); + setTimeout(() => { button.textContent = "copy"; }, 1500); + }); + pre.append(button); +}); diff --git a/web/content/_index.md b/web/content/_index.md new file mode 100644 index 0000000..341db58 --- /dev/null +++ b/web/content/_index.md @@ -0,0 +1,74 @@ +--- +title: zash +description: A small, fast POSIX shell for z/OS UNIX System Services, in the Almquist (ash) tradition. +--- + +## Why another shell + +The z/OS `/bin/sh` is dated, and the usual alternatives are bash and zsh. +Those are comfortable interactively but slow as scripting shells, large, and +encourage scripts that run nowhere else. On z/OS that cost is real: CPU time is +billed, and every `fork()` copies an address space. + +<div class="feature-grid"> + <div class="card"> + <span class="tag">cheap processes</span> + <h3>spawn(), not fork()</h3> + <p>Children come from <code>spawn()</code>, so <code>_BPX_SHAREAS</code> + can keep them in the same address space. Builtins cost no process at all, + even in a pipeline or a command substitution.</p> + </div> + <div class="card"> + <span class="tag">plain POSIX</span> + <h3>sh scripts, not a dialect</h3> + <p>Scripts written for zash run under the existing <code>/bin/sh</code>, + dash, FreeBSD sh and bash. The Korn features z/OS scripts use are there + where they cost other scripts nothing.</p> + </div> + <div class="card"> + <span class="tag">built for z/OS</span> + <h3>ASCII or EBCDIC</h3> + <p>The character set is a compile-time choice and the source assumes + neither. File tagging, <code>STEPLIB</code> and the z/OS shell behaviours + scripts rely on are in scope.</p> + </div> + <div class="card"> + <span class="tag">pleasant</span> + <h3>An interactive shell too</h3> + <p>Job control, tab completion, history, emacs and vi editing, with + bash's key bindings. None of it is initialised by a non-interactive + shell.</p> + </div> +</div> + +## How it compares + +CPU-seconds on Linux x86-64 from `make bench`, user+sys with children +included. The benchmark scripts check each shell's answers as well as timing +it. + +| benchmark | zash | dash | bash | ksh93 | oksh | +| --- | --- | --- | --- | --- | --- | +| `$(builtin)` x 40000 | 0.01 | 8.20 | 17.99 | 0.11 | 25.24 | +| small pipelines and `$(a \| b)` | 1.10 | 2.35 | 3.16 | 1.33 | 2.32 | +| render and check 100 configs | 0.38 | 0.46 | 0.53 | 0.26 | 0.52 | +| 2000 external commands | 0.55 | 0.53 | 0.81 | 0.56 | 0.84 | + +On z/OS the gap against IBM's `/bin/sh` is far wider, because a `fork()` there +copies an address space. The full tables for both platforms are in the +[project README](https://github.com/skurtz97/zash#status). + +## Get started + +```sh +git clone https://github.com/skurtz97/zash +cd zash +make # Linux: ./zash +make check # run the suite +``` + +On z/OS, `make` builds the ASCII `./zash` with IBM Open XL C/C++ and +`make zos-ebcdic` builds the EBCDIC variant. See +[Building zash]({{< relref "docs/install" >}}) for the z/OS targets and the +address-mode notes, and [Development]({{< relref "docs/develop" >}}) for what +the test suite covers. diff --git a/web/content/docs/_index.md b/web/content/docs/_index.md new file mode 100644 index 0000000..8893fad --- /dev/null +++ b/web/content/docs/_index.md @@ -0,0 +1,7 @@ +--- +title: Docs +--- + +Everything about building, testing and the current state of zash. The +authoritative documents are in the source tree: `README.md`, `DESIGN.md` and +`formal/zash-spec.pdf`. diff --git a/web/content/docs/develop.md b/web/content/docs/develop.md new file mode 100644 index 0000000..392987e --- /dev/null +++ b/web/content/docs/develop.md @@ -0,0 +1,46 @@ +--- +weight: 20 +title: Development +description: How zash is tested, benchmarked and kept warning-free. +--- + + +zash is one C23 source directory with a flat `.POSIX` makefile, and the tests +are shell scripts compared against expected output. + +## The suite + +```sh +make check # behavioural tests against ./zash +make asan # ASan + UBSan build, whole suite +make valgrind # whole suite under Valgrind, leaks included +make bench # CPU time against dash, bash, ksh, zsh, oksh +make format tidy # clang-format, clang-tidy +``` + +The tests are at several levels: + +- Behavioural tests for every feature. Portable ones also run under dash, and + the outputs are compared, so a disagreement with an existing ash-family + shell is always visible - either a bug or a deliberate difference. +- Sanitizer and Valgrind runs of the whole suite on Linux. +- Process accounting tests that assert the exact process count of a construct, + so `$(echo x)` creating a process fails the suite instead of quietly costing + a `fork()`. +- Security tests for what a shell must never do: create a file more permissive + than the umask allows, find a command in the current directory, or run what + an expansion or a file name produced. +- Interactive tests that drive the shell through a pseudo-terminal: editor keys + in emacs and vi modes, completion, history, prompts, job control. They need + python3 and are skipped without it. + +On z/OS the same behavioural and process-accounting tests run in either +character mode, plus a z/OS-only group. There is no ASan or Valgrind there; +Language Environment's heap checker does that job instead. + +## Benchmarks as tests + +`bench/run.sh` compares each shell's output with the reference shell's, so a +wrong answer fails the run instead of being timed and forgotten. `bench/ +report.sh` and `bench/deploy.sh` are the two scripts that look most like what +the shell is for. diff --git a/web/content/docs/install.md b/web/content/docs/install.md new file mode 100644 index 0000000..3b6d670 --- /dev/null +++ b/web/content/docs/install.md @@ -0,0 +1,62 @@ +--- +weight: 10 +title: Building zash +description: How to build zash on Linux and on z/OS, and what it links against. +--- + + +Two toolchains, one source tree: Clang on Linux, IBM Open XL C/C++ on z/OS. +The code is plain C23 and does not use library additions newer than the C +libraries on either platform. + +| Platform | Compiler | Standard | +| --- | --- | --- | +| Linux | Clang | `-std=c23` | +| z/OS | IBM Open XL C/C++ (`ibm-clang`) | `-std=c23` | + +## Linux + +```sh +git clone https://github.com/skurtz97/zash +cd zash +make # -> ./zash +make check # run the test suite against it +make install # copy it into $(DESTDIR)$(BINDIR) +``` + +`EDIT=libedit LDLIBS=-ledit` builds against libedit instead of the built-in +line editor. The default editor is compiled in and initialised only for an +interactive shell. + +## z/OS + +```sh +make # the ASCII build, ./zash +make zos-ebcdic # the EBCDIC (IBM-1047) build, ./zash-ebcdic +make zos-check # the functional tests, then the EBCDIC ones +``` + +Both builds are 64-bit XPLINK. There is a zopen `buildenv` in the tree, so +`zopen build -gp` builds both test passes and installs into +`$ZOPEN_INSTALL_DIR`. + +`make zos-heapcheck` runs the suite with Language Environment check zones +after every heap element, `make zos-debug` and `make zos-dbx` open a debug +build under `dbx`, and `make zos-amblist` maps the CSECTs of the program +object. + +## Choosing an address mode + +Both builds are 64-bit. A 64-bit `fork()` used to cost 4.2 ms against 0.10 ms +for 31-bit, and a trivial program started in 29.5 ms against 1.1 ms, because +the 64-bit C run-time was loaded out of the linklist on every start. With that +run-time in the LPA the two widths cost the same, so the shell takes the wider +one. `bench/README.md` in the source tree has the measurements. + +## Documentation targets + +`make doc` builds the source reference with Doxygen into `docs/html`, and a +PDF when `pdflatex` is present. `make docs` adds HTML and PDF of `README.md` +and `DESIGN.md`, `make spec` typesets `formal/zash-spec.pdf` with typst, and +`make other-docs` runs the last two together. On z/OS those tools are usually +missing; the targets say so rather than failing silently. diff --git a/web/content/docs/status.md b/web/content/docs/status.md new file mode 100644 index 0000000..2c3b247 --- /dev/null +++ b/web/content/docs/status.md @@ -0,0 +1,40 @@ +--- +weight: 30 +title: Status +description: What works on Linux and on z/OS today, and what is still from documentation. +--- + + +## Linux + +Feature-complete for a first release: the scripting core, the FreeBSD and Korn +extensions, job control, and the interactive layer (built-in editor with emacs +and vi modes, completion, history, `fc`, libedit optional). It builds +warning-free with Clang as C23 and passes its suite plain, under ASan/UBSan and +under Valgrind. + +## z/OS + +Builds in both character modes with Open XL, 64-bit, passes its suite including +the `zos/` group, and debugs with `dbx`. The Language Environment heap-checker +run is the one exception: two signal tests fail there and pass in `zos-check`. + +Data set redirection and `tso` are the parts still written from documentation. + +## Language level + +Plain C23, and the project draws the line at the language itself: no +`<stdbit.h>`, `<stdckdint.h>` or other library additions newer than the +platforms' C libraries. A system whose libc is older still builds it. + +## Not planned + +- bash or ksh93 extensions: arrays, process substitution, `${var//a/b}`, brace + expansion, coprocesses. +- The legacy z/OS XL C/C++ compiler (`xlc`). +- Portability to every UNIX. Linux is supported and most development and all + sanitizer testing happens there; other POSIX systems will probably work but + are not a target. + +The roadmap and the reasoning behind each decision are in `DESIGN.md` in the +source tree. diff --git a/web/hugo.toml b/web/hugo.toml new file mode 100644 index 0000000..31d4b72 --- /dev/null +++ b/web/hugo.toml @@ -0,0 +1,37 @@ +# Site configuration. The site lives in web/ and is built with Hugo: +# +# hugo server --source web # http://localhost:1313/ +# hugo --source web --minify # -> web/public/ +# +# baseURL is the deployed address; --baseURL overrides it for a preview. + +baseURL = "https://zash.example.org/" +title = "zash" +locale = "en-us" +enableRobotsTXT = true +# No taxonomies: every page is written by hand. +disableKinds = ["taxonomy", "term"] + +# The pages are ours, so the few <p class="lede"> blocks are allowed through. +[markup.goldmark.renderer] + unsafe = true + +# Classes, not inline styles: assets/css/chroma.css is generated from the same +# style, so a code block sits in the page instead of a monokai box. +[markup.highlight] + noClasses = false + style = "tokyonight-night" + +[params] + description = "A small, fast POSIX shell for z/OS UNIX System Services, in the Almquist (ash) tradition." + repo = "https://github.com/skurtz97/zash" + +[[menu.main]] + name = "Docs" + pageRef = "/docs" + weight = 10 + +[[menu.main]] + name = "GitHub" + url = "https://github.com/skurtz97/zash" + weight = 20 diff --git a/web/layouts/404.html b/web/layouts/404.html new file mode 100644 index 0000000..8fa61b3 --- /dev/null +++ b/web/layouts/404.html @@ -0,0 +1,7 @@ +{{ define "main" }} +<div class="notfound"> + <h1>404</h1> + <p class="lede">No such command.</p> + <p><a href="{{ "/" | relURL }}">Back to the shell</a></p> +</div> +{{ end }} diff --git a/web/layouts/baseof.html b/web/layouts/baseof.html new file mode 100644 index 0000000..551753b --- /dev/null +++ b/web/layouts/baseof.html @@ -0,0 +1,46 @@ +<!doctype html> +<html lang="{{ site.Language.Locale }}"> +<head> + {{ partial "head.html" . }} +</head> +<body> + <a class="skip" href="#main">Skip to content</a> + + <header class="site"> + <div class="bar"> + <a class="brand" href="{{ "/" | relURL }}"> + <img src="{{ "zash-logo.svg" | relURL }}" alt="" width="30" height="30"> + <span>zash</span> + </a> + <nav> + {{ range site.Menus.main }} + {{ $current := eq .URL $.RelPermalink }} + <a href="{{ .URL }}"{{ if $current }} aria-current="page"{{ end }}>{{ .Name }}</a> + {{ end }} + </nav> + </div> + </header> + + <main id="main"> + {{ block "main" . }}{{ end }} + </main> + + <footer class="site"> + <div class="cols"> + <p> + zash · MIT OR Apache-2.0 OR BSD-2-Clause, at your option + </p> + <p> + <a href="{{ site.Params.repo }}">Source</a> · + <a href="{{ site.Params.repo }}/issues">Issues</a> · + <a href="{{ site.Params.repo }}/blob/main/DESIGN.md">Design notes</a> + </p> + </div> + </footer> + + {{- with resources.Get "js/copy.js" }} + {{- $js := . | minify | fingerprint }} + <script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" defer></script> + {{- end }} +</body> +</html> diff --git a/web/layouts/home.html b/web/layouts/home.html new file mode 100644 index 0000000..13fda77 --- /dev/null +++ b/web/layouts/home.html @@ -0,0 +1,41 @@ +{{ define "main" }} +<section class="hero"> + <div> + <h1><span class="prompt">$</span> zash</h1> + <p class="lede"> + A small, fast POSIX shell for z/OS UNIX System Services, in the Almquist + (ash) tradition. Written from scratch in C23, built with Clang and IBM + Open XL. + </p> + <div class="actions"> + <a class="btn primary" href="{{ "docs/install/" | relURL }}">Get started</a> + <a class="btn" href="{{ site.Params.repo }}">GitHub</a> + </div> + <div class="badges"> + <span>C23</span> + <span>spawn(), not fork()</span> + <span>ASCII or EBCDIC</span> + <span>POSIX sh</span> + </div> + </div> + + <div class="term"> + <div class="term-bar"> + <span class="dot"></span><span class="dot"></span><span class="dot"></span> + <span class="title">zash</span> + </div> + <pre><code><span class="cmd">./zash -c 'for i in 1 2 3; do print $i; done'</span> +<span class="out">1 +2 +3</span> +<span class="cmd">make bench</span> +<span class="out">render 100 configs</span> <span class="ok">zash 0.38</span> <span class="out">bash 0.53</span> +<span class="cmd">echo $((6 * 7))</span> +42<span class="cursor"></span></code></pre> + </div> +</section> + +<article> + {{ .Content }} +</article> +{{ end }} diff --git a/web/layouts/list.html b/web/layouts/list.html new file mode 100644 index 0000000..eccd90b --- /dev/null +++ b/web/layouts/list.html @@ -0,0 +1,27 @@ +{{ define "main" }} +{{ if eq .Section "docs" }} +<div class="docs"> + {{ partial "docs-nav.html" . }} + <article> + <div class="docs-head"> + <p class="kicker">docs</p> + <h1>{{ .Title }}</h1> + {{ with .Content }}{{ . }}{{ end }} + </div> + <ul class="pages"> + {{ range .Pages.ByWeight }} + <li> + <a href="{{ .RelPermalink }}">{{ .Title }}</a> + {{ with .Description }}<span class="summary">{{ . }}</span>{{ end }} + </li> + {{ end }} + </ul> + </article> +</div> +{{ else }} +<article> + <h1>{{ .Title }}</h1> + {{ .Content }} +</article> +{{ end }} +{{ end }} diff --git a/web/layouts/partials/docs-nav.html b/web/layouts/partials/docs-nav.html new file mode 100644 index 0000000..213a1eb --- /dev/null +++ b/web/layouts/partials/docs-nav.html @@ -0,0 +1,16 @@ +{{ with site.GetPage "/docs" }} +<aside> + <div class="group"> + <h2>Docs</h2> + {{ range .Pages.ByWeight }} + <a href="{{ .RelPermalink }}"{{ if eq .RelPermalink $.RelPermalink }} aria-current="page"{{ end }}>{{ .Title }}</a> + {{ end }} + </div> + <div class="group"> + <h2>Source</h2> + <a href="{{ site.Params.repo }}/blob/main/README.md">README</a> + <a href="{{ site.Params.repo }}/blob/main/DESIGN.md">DESIGN.md</a> + <a href="{{ site.Params.repo }}/blob/main/formal/zash-spec.pdf">Specification (PDF)</a> + </div> +</aside> +{{ end }} diff --git a/web/layouts/partials/head.html b/web/layouts/partials/head.html new file mode 100644 index 0000000..e145475 --- /dev/null +++ b/web/layouts/partials/head.html @@ -0,0 +1,26 @@ +{{- $desc := or .Description site.Params.description -}} +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<meta name="theme-color" content="#0b0e17"> +<meta name="color-scheme" content="dark"> +<title>{{ if .IsHome }}{{ site.Title }} · a POSIX shell for z/OS UNIX{{ else }}{{ .Title }} · {{ site.Title }}{{ end }}</title> +<meta name="description" content="{{ $desc }}"> +<link rel="canonical" href="{{ .Permalink }}"> + +<meta property="og:site_name" content="{{ site.Title }}"> +<meta property="og:title" content="{{ if .IsHome }}{{ site.Title }}{{ else }}{{ .Title }}{{ end }}"> +<meta property="og:description" content="{{ $desc }}"> +<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}"> +<meta property="og:url" content="{{ .Permalink }}"> +<meta property="og:image" content="{{ "zash-logo.svg" | absURL }}"> +<meta name="twitter:card" content="summary"> + +<link rel="icon" href="{{ "zash-logo.svg" | relURL }}" type="image/svg+xml"> +{{- with resources.Get "css/zash.css" }} + {{- $css := . | minify | fingerprint }} +<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}"> +{{- end }} +{{- with resources.Get "css/chroma.css" }} + {{- $chroma := . | minify | fingerprint }} +<link rel="stylesheet" href="{{ $chroma.RelPermalink }}" integrity="{{ $chroma.Data.Integrity }}"> +{{- end }} diff --git a/web/layouts/single.html b/web/layouts/single.html new file mode 100644 index 0000000..8171148 --- /dev/null +++ b/web/layouts/single.html @@ -0,0 +1,23 @@ +{{ define "main" }} +{{ if eq .Section "docs" }} +<div class="docs"> + {{ partial "docs-nav.html" . }} + <article> + <div class="docs-head"> + <p class="kicker">docs</p> + <h1>{{ .Title }}</h1> + {{ with .Description }}<p class="lede">{{ . }}</p>{{ end }} + </div> + {{ .Content }} + <p class="edit"> + <a href="{{ site.Params.repo }}/edit/main/web/content/{{ .File.Path }}">Edit this page</a> + </p> + </article> +</div> +{{ else }} +<article> + <h1>{{ .Title }}</h1> + {{ .Content }} +</article> +{{ end }} +{{ end }} diff --git a/web/static/zash-logo.svg b/web/static/zash-logo.svg new file mode 100644 index 0000000..3f3ee3f --- /dev/null +++ b/web/static/zash-logo.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"> + <title>zash</title> + <defs> + <radialGradient id="screen" cx="50%" cy="45%" r="70%"> + <stop offset="0" stop-color="#16213f"/> + <stop offset="1" stop-color="#0b0e17"/> + </radialGradient> + <filter id="glow" x="-30%" y="-30%" width="160%" height="160%"> + <feGaussianBlur stdDeviation="10" result="b"/> + <feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge> + </filter> + <pattern id="scan" width="512" height="8" patternUnits="userSpaceOnUse"> + <rect y="5" width="512" height="3" fill="#000" fill-opacity="0.35"/> + </pattern> + <clipPath id="clip"><rect width="512" height="512" rx="96"/></clipPath> + </defs> + <g clip-path="url(#clip)"> + <rect width="512" height="512" fill="url(#screen)"/> + <g fill="none" stroke-linecap="round" stroke-linejoin="round" filter="url(#glow)"> + <path d="M96 186 L176 256 L96 326" stroke="#8fa6d9" stroke-opacity="0.75" stroke-width="44"/> + <path d="M236 186 H398 L250 326 H410" stroke="#5b86ff" stroke-width="48"/> + </g> + <rect width="512" height="512" fill="url(#scan)"/> + </g> +</svg> |
