Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design/refactor.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Verdicts are from the verification at 1f9b651. Line numbers are those of that co
| D10 | dialect commandFeatures reads options with a regex over all words | confirmed | 1.1 | PR #212 | commandFeatures reads the builtin's parse; also finds `trap ERR` (one word). "the dialect check reads a builtin's options from its parse, as dash does" (test/dialect.test.ts) |
| D11 | embeddedTextInner switch → registry | proposal, same seam as A9 | 3.1 | PR #237 | src/embedded/registry.ts: `EMBEDDED`, one explainer per `EmbeddedLang` with one return shape (`{ tokens, note? }`, undefined when the text is not of the language); what one needs of the command (regex flavor, `tr` role, perl's letters) it asks of an `EmbeddedContext`. The analyzer's `embeddedTextInner` calls it, then `embeddedExample` for the worked example, only when the text was explained (as before). Every dump unchanged; same output as main on the corpus (see A9) |
| D12 | sed and perl have two parsers each | proposal | — | won't do (for now) | see "Not planned" |
| D13 | extras files patch other entries' options | confirmed | 3.5 | planned | |
| D13 | extras files patch other entries' options | confirmed | 3.5 | PR #249 | src/dict/extras.ts, extrasFiles.ts, extrasAdmin.ts and `applyExtras` are gone: each command's extra options and subcommands are in the entry of the file that defines it (a name the main entry defined keeps the main entry's meaning, as `mergeOptions` did). A dump of every entry of `commands` and `builtins` (options, values, texts, subcommands) is identical before and after, option and subcommand order included (the extras came first, then the entry's own); sample.sh dump unchanged. test/dictionary.test.ts fails if an extras file or `applyExtras` comes back; `cmd()` throws on an option named twice. scripts/check-dict-manpages.ts walks every dict table |
| D14 | hosts.ts per-CI flags → table; split | confirmed | 3.4 | PR #229 | `CI_SYSTEMS` in src/hosts/yaml.ts holds, per CI system, its detection, label and rules (Windows `script:` skipped, `with:` inputs skipped, `command:` a shell only for GitHub); `stepCi` picks the system of a step; the flags `githubLike`/`circleci`/`azure`/`azureWindows` and the label ternary are gone; src/hosts.ts is split into src/hosts/ (index with the types and the public API, builder, bats, dockerfile, makefile, jenkinsfile, yaml, npm, markdown, python, remap). Dumps of test/fixtures/hosts/* and sample.sh (en, ja) byte-identical; test/hosts.test.ts and the suite unchanged, coverage 100% |
| P1 | Code actions only for `shellscript` | corrected: only dialect diagnostics have fixes, so host files are not affected; a language id added in the setting is | 1.5 | PR #208 | integration/extension.itest.ts "offers the quick fix in a language added to bashExplainer.languages" (not run here: needs a downloaded VS Code) |
| P2 | VS Code reads settings by hand | confirmed (`readSettings`/`explainOptions` exist in src/settings.ts) | 2.4 | PR #218 | test/document-setup.test.ts "settingsFromEditor" (getter, fallback to the default, unknown list items dropped, minimum, read-only proxies); settings are cached until the configuration changes; VS Code code reads `service.settings`, no `config.get(key, default)` is left. The VS Code integration test (CI) runs the rest |
Expand Down
2 changes: 1 addition & 1 deletion docs/design/semantics.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ The code (src/argv/) differs from 3.2–3.4 in these points:
- A word that becomes known words (`a{,.bak}`) gives each its role (`each`). An operand whose role depends on how many words an expansion gives is `uncertain`, with the role it may have instead (`otherwise`), or the roles of its words when it gives several (`several`).
- There is no converter (A4): every dictionary entry is a `CommandSpec`. `cmd(ja, en, options, rest)` (src/dict/types.ts) builds it from options written as tuples (`OptSpec`, with the flags `arg`, `arg2`, `until`, `fills`, `attached`, `next:<re>`, `lang:<name>` and `persistent`) or as option specs, and from any field of a spec. `positional` (and `positionalLang`) is a shorthand for the last operand alternative: the operands in order, each optional, the last repeating; an option with `fills` adds an alternative before it without the first operand (`grep -e`). `byCount` and `lastIsDestination` write alternatives by count (`seq`, `cp`). The rules the old walk applied by name are in the entries: find's `operandParser` and `expressionSpec`, jq's `longEquals: false` and the `laterOperands` of `--args`, `head`'s and `tail`'s `countOption`, and awk's `assignmentText`. A tuple that gives a language or meanings of values without a value is an error when the dictionary loads.
- The flag `persistent` of a tuple (`persistent(list)`) becomes `OptionSpec.persistent`. A subcommand's own option of the same name wins over an inherited one (`kubectl logs -f`, `docker compose run -p`).
- A list of options names each option once: `mergeOptions` throws when a name is given twice in one list. It puts a second list over the first, whose names win: the options of src/dict/extrasFiles.ts and extrasAdmin.ts are merged so, with the entry's own options over them; extra subcommands do not replace the entry's. (A customCommands entry that names an option twice means what it says last.)
- A list of options names each option once: `mergeOptions` throws when a name is given twice in one list. It puts a second list over the first, whose names win. No file patches the options or subcommands of another file's entry (the extras files were merged into their entries; test/dictionary.test.ts checks). (A customCommands entry that names an option twice means what it says last.)
- `CommandSpec.program`: the spec of the program named like a builtin (coreutils `echo`, `printf`, `pwd`, `test`, `true`, `false`; procps `kill`). A path (`/bin/kill`) and a slot that starts a program (`env echo`, `sudo kill`) read the words with it, and get no pitfall; its options may differ (procps kill has no `-n` and no job specs, coreutils printf no `-v`).
- `CommandSpec.builtin` is the only mark of a builtin. The analyzer reads it for the kind of a command, for "(shell builtin)", and for the assignments before a special builtin in POSIX mode (until B3 builds `NameResolution` from it). It reads `plusOptions` for `declare +x` too.
- The builtins of src/dict/builtins.ts are written with `b` (regular, `style: 'posix'`) and `special`, and their operands with `args(...)`: each optional, the last repeating. `exit`, `return`, `shift`, `break`, `continue` and `logout` have `style: 'none'` (`exit -1` is a number). kill's signal patterns and marks, echo's modes and its literal `--`, and set's `next-only` `-o` are in their entries.
Expand Down
24 changes: 7 additions & 17 deletions scripts/check-dict-manpages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*
* Pages are cached under $MANPAGE_CACHE (default: a directory in the system temp directory), never in the
* repository.
* Checked: the commands of basic, storage, admin, netadmin and monitor (their options and
* subcommands' options) and the extra options of extras*.ts. macOS commands are not on Debian.
* Checked: the commands of core, basic, storage, admin, netadmin, monitor, system, distro and ops (their options and
* subcommands' options). macOS commands are not on Debian.
*
* Output: per command, the options of ours that neither the page nor `--help` mention (suspect),
* the number of options the page has that we lack, and the commands without a page.
Expand All @@ -21,11 +21,11 @@ import { storage } from '../src/dict/storage';
import { admin } from '../src/dict/admin';
import { netadmin } from '../src/dict/netadmin';
import { monitor } from '../src/dict/monitor';
import { extraFiles } from '../src/dict/extrasFiles';
import { extraAdmin } from '../src/dict/extrasAdmin';
import { extraSubcommands } from '../src/dict/extras';
import { core } from '../src/dict/commands';
import { system } from '../src/dict/system';
import { distro } from '../src/dict/distro';
import { ops } from '../src/dict/ops';
import type { CommandSpec } from '../src/argv/spec';
import { cmd } from '../src/dict/types';

const SUITE = 'trixie'; // the current Debian stable release
const BASE = 'https://manpages.debian.org';
Expand Down Expand Up @@ -56,24 +56,14 @@ function targets(): Map<string, Map<string, string[]>> {
m.set(key, [...(m.get(key) ?? []), ...names]);
out.set(cmdName, m);
};
for (const table of [basic, storage, admin, netadmin, monitor]) {
for (const table of [core, basic, storage, admin, netadmin, monitor, system, distro, ops]) {
for (const [name, doc] of Object.entries(table)) {
const m = new Map<string, string[]>();
collect(name, doc, m);
for (const [k, v] of m) add(name, k, v);
if (!m.size) out.set(name, out.get(name) ?? new Map());
}
}
for (const table of [extraFiles, extraAdmin]) {
for (const [name, specs] of Object.entries(table)) add(name, name, cmd('', '', specs).options!.flatMap((o) => o.names));
}
for (const [name, subs] of Object.entries(extraSubcommands)) {
for (const [sub, d] of Object.entries(subs)) {
const m = new Map<string, string[]>();
collect(`${name} ${sub}`, d, m);
for (const [k, v] of m) add(name, k, v);
}
}
return out;
}

Expand Down
Loading
Loading