Produkt
Katalog poleceń
Jeden katalog definiuje każde polecenie, a wiązanie, pomoc, opis dla modelu, strony referencyjne i zestaw zgodności czytają go wszystkie.
Czym jest katalog
Katalog poleceń jest jedynym źródłem sygnatur poleceń. Czytają go wiązanie, wbudowana pomoc, opis dla modelu, dokumentacja referencyjna, definicje narzędzi i zestaw zgodności, tak jak definiuje to specyfikacja katalogu. Składa się z plików TOML w formacie nurt-catalog/1: core.toml dla poleceń rdzenia, jednego pliku dla każdej opcjonalnej grupy oraz indeksu (_index.toml), który wymienia pliki i oczekiwaną liczbę poleceń.
Wpis każdego polecenia podaje jego nazwę, kategorię (source, transform, check, change, run, system, journal lub help), odwracalność (read, reversible, reversible_if_preserved lub irreversible), rodzaje rekordów wejścia i wyjścia oraz parametry z typem, pozycją, wartością domyślną i streszczeniem. Polecenie może należeć do jednego systemu operacyjnego; w innym systemie wiązanie odpowiada kodem E_OS_ONLY.
[[command]]
name = "set"
category = "change"
reversibility = "reversible"
effect = "local"
implementation = "builtin"
input = ["none", "entry"]
output = ["effect"]
summary = "Set values at key paths, preserving layout."
Zmiany wykonane przez polecenie są zapisywane w dzienniku zgodnie z podaną tu odwracalnością.
Polecenia rdzenia i opcjonalne grupy
34 polecenia rdzenia są zawsze opisywane modelowi. Obejmują pliki (list, find, info, read, lines, write, copy, move, remove, rename, create, attributes), tekst (search, replace, insert, edit), rekordy (filter, select, sort, first, last, skip, count), kontrole (assert, verify), programy (run, jobs, stop, retry), dziennik (history, undo, redo), kontynuację skróconej odpowiedzi (next) oraz help. Pozostałe polecenia należą do opcjonalnych grup, opisywanych na żądanie.
| Grupa | Polecenia | Obejmuje | Dokumentacja |
|---|---|---|---|
| core | 34 | pliki, tekst, rekordy, programy, dziennik i pomoc | strony poleceń |
| documents | 3 | dokumenty strukturalne według klucza i bazy SQLite | set |
| text | 11 | różnice, łatki, skróty, kodowania, wyrażenia i operacje na rekordach | diff |
| code | 13 | symbole, definicje, odwołania, diagnostyka, zmiana nazw, profil repozytorium | code.symbols |
| notebook | 10 | komórki notatników Jupyter | notebook.cells |
| git | 22 | repozytoria Git | grupa git |
| archive | 5 | archiwa i kompresja | archive.list |
| system | 11 | procesy, porty, dyski, host, środowisko, dzienniki systemowe, zawieszanie | grupa system |
| administration | 34 | usługi, konta, grupy, montowania, parametry jądra, zasilanie, dyski, dostawca rejestru, CIM, zapora sieciowa, trasy, DNS i zegar | grupa administration |
| package | 5 | systemowe menedżery pakietów | grupa package |
| network | 5 | żądania HTTP, pobieranie, rozpoznawanie nazw, ping, interfejsy | grupa network |
| schedule | 7 | harmonogramy potoków | grupa schedule |
| journal | 5 | dziennik: miejsce, limity, stan, przypięte wpisy, czyszczenie | journal.status |
| program | 4 | zainstalowane programy: wyszukiwanie, opisy | grupa program |
| verify | 8 | testy i analiza kodu przez typowane opakowania | test.run |
Strony grup opisują zakres, rekordy, różnice między platformami i odwracalność; pozostałe grupy są opisane na stronach ich poleceń. Grupa administration ma od wersji 0.1.1 34 polecenia.
Jak zbudowana jest strona polecenia
Każde polecenie katalogu ma jedną stronę i każda strona należy do polecenia. Strona ma stałą kolejność sekcji, określoną w konwencjach dokumentacji poleceń:
| Sekcja | Źródło |
|---|---|
| Synopsis | generowana z katalogu |
| Description | pisana ręcznie |
| Parameters (nazwa, typ, wartość domyślna, opis) | generowana, opisy można rozszerzać |
| Input and output | generowana |
| Effect (kategoria, odwracalność i jej warunki) | generowana, uwagi pisane ręcznie |
| Examples (co najmniej trzy) | pisane ręcznie |
| Errors i Related | pisane ręcznie |
Pierwsze trzy przykłady to te, które pokazuje help <command>.
Jak kompilacja sprawdza strony
Kompilacja dokumentacji weryfikuje, że:
- każde polecenie ma stronę, a każda strona należy do polecenia;
- front matter (
command,group,summary) jest równy katalogowi; - sekcja generowana jest równa tekstowi wygenerowanemu z katalogu;
- strona ma co najmniej trzy bloki
nurt example; - każdy przykład daje się przeanalizować, wiąże się, uruchamia się na wirtualnym systemie plików i daje oczekiwany fragment wyniku;
- nazwa polecenia lub parametru w odwrotnych apostrofach istnieje w katalogu.
Zestaw testów sprawdza każdy plik catalog/: nazwy są poprawne i niepowtarzalne, każde wyrażenie typu daje się przeanalizować, parametr wymagany nie ma wartości domyślnej, a indeks wymienia każdy plik z właściwą liczbą poleceń, sumującą się do total.
Jak sprawdzane są nazwy, parametry i typy
Wiązanie działa przed jakimkolwiek skutkiem. Program, który nie może być poprawny, jest odrzucany kodem nazywającym problem, a błąd wymienia najbliższe nazwy lub dopuszczalne typy, więc poprawka jest częścią odpowiedzi.
| Kod | Problem |
|---|---|
E_UNKNOWN_COMMAND, E_UNKNOWN_PARAM |
nieznana nazwa; expected wymienia do ośmiu najbliższych nazw |
E_MISSING_PARAM |
brakuje parametru wymaganego |
E_PARAM_CONFLICT |
podano razem parametry, które się wykluczają |
E_TYPE |
wartość lub strumień rekordów ma typ, którego to miejsce nie przyjmuje |
E_UNKNOWN_VALUE |
wartość wyliczenia, która nie istnieje |
Typy zapisuje się jako wyrażenia, takie jak path | list<path>, enum(report|force|abort) czy stream<entry>. Tekst w cudzysłowie jest w miejscu danego typu przekształcany na path, glob, instant, key, size lub duration. Każde związane drzewo zapisuje catalog_rev, czyli SHA-256 kanonicznego katalogu, więc każda zmiana polecenia, parametru lub opisu zmienia rewizję.
Wszystkie polecenia
Poniższy indeks wymienia każde polecenie z jego streszczeniem. Każda nazwa prowadzi do strony polecenia ze składnią, parametrami, skutkami, błędami i przykładami.
Rdzeń68 poleceń
-
accountsList user accounts and groups. -
assertStop the program with E_ASSERT unless the records meet one condition. -
attributesChange permissions, account, times and extended attributes of entries. -
compressCompress files individually with gzip, zstd, xz, bzip2 or lz4. -
convertConvert the text encoding, line endings or byte order mark of files. -
copyCopy files and directories. -
countCount the records. -
createCreate files, directories, links, junctions, named pipes, device nodes or temporary entries. -
decompressDecompress individually compressed files. -
describeList the fields of the input records with their types and an example value. -
diffCompare two files, or the input with a file or named result, and return the differences as hunks. -
disableStop the input services from starting automatically. -
disksList mounted volumes with capacity and free space. -
distinctKeep one record of each distinct value with the number of occurrences. -
editApply a list of changes to one file, all or none. -
enableMake the input services start automatically at boot or login. -
environmentList environment variables with their values. -
evaluateEvaluate an expression with arithmetic, times, sizes and built-in functions. -
filterKeep the records that meet a condition. -
findFind entries under a directory by name pattern and attributes. -
firstKeep the first records. -
groupGroup records by a field or expression and count each group. -
hashCompute digests of file contents. -
helpDescribe commands, groups, errors, guides, the syntax and corrections. -
historyList operations of the journal. -
hostDescribe the operating system, hardware, current account and home and temporary directories. -
infoDescribe paths, including paths that do not exist. -
insertInsert text before or after lines, matches or nodes, or at the start or end of files. -
jobsRead the state, output or result of background jobs. -
lastKeep the last records. -
linesProduce the lines of a file or of the input content. -
listList the entries of a directory. -
logsRead events from the system log: systemd journal, Windows Event Log or macOS unified log. -
mountMount a device or volume. -
moveMove files and directories. -
nextRead the next part of a shortened result. -
open_filesList the processes that hold a file or directory open. -
parseExtract fields from text with the named groups of a regular expression. -
patchApply a unified or git diff to files under a root directory. -
portsList network ports and the processes that hold them. -
processesList running processes. -
querySelect and transform document values with a jq filter. -
readRead text, images, PDF pages, notebooks or document keys. -
redoApply an undone operation again. -
removeRemove files, directories, registry keys and values, lines, matches, document items, syntax nodes or finished jobs. -
renameRename entries by pattern or to a new name. -
replaceReplace text in files or in the found text. -
restartRestart the input services. -
resumeResume suspended jobs or processes. -
retryRun the command of a job again with the same working directory and environment. -
runRun a program without a shell; after wait it continues as a background job. -
searchSearch file content for text, regular expressions or syntax patterns. -
selectKeep the given fields of each record and add computed fields. -
servicesList system or user services with their state and start type. -
setSet values at key paths of a JSON, YAML, TOML, XML, INI, CSV, properties, env or plist document, preserving its layout. -
skipDrop the first records. -
sleepWait for a duration. -
sortSort the records by fields. -
splitSplit lines into columns at a delimiter. -
sqlRun SQL statements on an SQLite database file; a statement that changes anything makes the call a change. -
startStart the input services. -
stopStop jobs, processes or services. -
summarizeCompute count, sum, minimum, maximum and average of fields, optionally per group. -
suspendSuspend the input jobs or processes until they are resumed. -
undoUndo operations from the journal. -
unmountUnmount a mount point. -
verifyCheck a change with a pipeline and roll the change back when the check fails. -
writeWrite text, bytes or records to a file.
accounts4 poleceń
-
accounts.createCreate a user account. -
accounts.modifyChange the shell, home, groups, comment or lock state of an account. -
accounts.passwordSet the password of an account. -
accounts.removeRemove a user account.
analyze4 poleceń
-
analyze.checkCheck code with type checkers, linters, format checks, complexity and duplication analysis, and return a verdict. -
analyze.formatFormat source files with the formatter configured for each language. -
analyze.showShow the findings of an earlier analysis. -
analyze.toolsList the analysis tools detected for a project and whether they are installed.
archive3 poleceń
-
archive.createCreate an archive from the input entries. -
archive.extractExtract an archive into a directory, skipping entries that resolve outside it. -
archive.listList the entries of a zip, tar, compressed tar, 7z, jar, whl or apk archive.
clock3 poleceń
-
clock.ntpSwitch network time synchronisation on or off. -
clock.setSet the date and time of the clock. -
clock.timezone_setSet the time zone of the system.
code13 poleceń
-
code.actionsList the code actions a language server offers for a range of lines. -
code.call_hierarchyList the callers and callees of a function. -
code.definitionFind the definition of the symbol at a position or with a name. -
code.diagnosticsReport errors and warnings in source files. -
code.hoverShow the signature and documentation of the symbol at a position. -
code.implementationsFind implementations of an interface or types derived from the symbol. -
code.languagesList supported languages with file extensions, grammar versions and language server state. -
code.outlineList the symbols of a file as an outline. -
code.profileProfile a repository: build and test commands, entry points, change hotspots from history and manifests. -
code.referencesFind references to the symbol at a position, with a name or from the input. -
code.renameRename a symbol and its references across files in one operation. -
code.symbolsFind symbol definitions by name across a repository. -
code.type_definitionFind the definition of the type of the symbol.
disks2 poleceń
-
disks.formatCreate a file system on a device. -
disks.partitionCreate, delete or resize a partition.
firewall4 poleceń
-
firewall.allowAllow traffic on a port. -
firewall.denyDrop traffic on a port. -
firewall.removeRemove the firewall rules that match a port, protocol, source, direction and zone. -
firewall.rulesList the rules of the firewall with their action, protocol, port, source, direction and zone.
git22 poleceń
-
git.blameShow the commit and author that last changed each line of a file. -
git.branchList branches, or create, rename, switch or delete them. -
git.checkpointCreate, list, compare, restore or delete checkpoints of the working tree and index kept outside branches. -
git.cloneClone a repository over HTTPS or SSH into a new directory. -
git.commitRecord a commit and report its branch and files. -
git.diffShow differences between revisions, the index and the working tree. -
git.fetchFetch objects and references from a remote over HTTPS or SSH. -
git.logList commits of a revision, optionally limited to files, authors, dates or content. -
git.mergeMerge a branch into the current branch, or continue or abort a merge. -
git.pullFetch from a remote and integrate the changes into the current branch. -
git.pushUpdate references on a remote with local commits. -
git.rebaseReplay the commits of the current branch onto another revision, or continue, skip or abort a rebase. -
git.resetMove the current branch to a revision, optionally resetting the index and working tree. -
git.restoreRestore files or selected hunks in the working tree or index from a revision. -
git.reviewCheck changes before a commit for conflict markers, whitespace errors, large or binary files, secrets, missing tests and subject format. -
git.showShow commits with their changes, or the content of a file at a revision. -
git.stageList, stage or unstage changes down to selected hunks and lines. -
git.stashSave uncommitted changes in the stash, or list, show, apply, pop, drop or clear stash entries. -
git.statusShow the state of the working tree and index of one or more repositories. -
git.switchSwitch the working tree to a branch. -
git.tagList tags, or create or delete a tag. -
git.worktreeAdd, list or remove linked working trees.
groups4 poleceń
-
groups.add_memberAdd an account to a group. -
groups.createCreate a group. -
groups.removeRemove a group. -
groups.remove_memberRemove an account from a group.
http2 poleceń
-
http.downloadDownload a file over HTTP, resuming a partial download when possible. -
http.requestSend an HTTP request and return the response, optionally as text or Markdown.
journal5 poleceń
-
journal.limitsShow the active expiry limits, or change them and report how many entries will expire. -
journal.pinProtect journal entries from expiry by steps, age and size, or release that protection. -
journal.purgeRelease journal entries and the space they hold. -
journal.spaceReport free space, space reclaimable from the journal and the reserve of each volume. -
journal.statusReport the number of entries, space used, oldest entry and active limits with their sources.
modules2 poleceń
-
modules.loadLoad a kernel module. -
modules.unloadUnload a kernel module.
network6 poleceń
-
network.dns_setSet the DNS servers and search domains of an interface; an empty list of servers returns to automatic servers. -
network.interfacesList network interfaces with addresses, MAC address, state and MTU. -
network.pingSend ICMP echo requests to a host and report round-trip times. -
network.resolveResolve DNS records of a name. -
network.route_addAdd a route to the routing table. -
network.route_removeRemove the routes that match a destination, next hop, interface and metric.
notebook10 poleceń
-
notebook.cellsList notebook cells, as an outline or with full content. -
notebook.clear_outputsClear the outputs of notebook cells. -
notebook.copyCopy a cell to another position. -
notebook.exportExport a notebook to a new script, Markdown or text file. -
notebook.insertInsert a new cell into a notebook. -
notebook.moveMove a cell to another position. -
notebook.normalizeAdd missing cell identifiers and nbformat 4 fields. -
notebook.opsApply a list of cell operations in one write. -
notebook.removeRemove cells from a notebook. -
notebook.replaceReplace the source or type of a cell, or text within cell sources.
package5 poleceń
-
package.installInstall packages. -
package.listList installed packages. -
package.removeRemove installed packages. -
package.searchSearch the package repositories. -
package.upgradeUpgrade installed packages to their newest versions.
power3 poleceń
-
power.cancelCancel a scheduled restart or shutdown. -
power.restartRestart the system now or at a given time. -
power.shutdownShut down the system now or at a given time.
program4 poleceń
-
program.catalogBrowse programs by category: categories, then subcategories or programs. -
program.describeDescribe a program with its version, source, description and usage guide. -
program.findLocate programs in PATH, in the order the system resolves them. -
program.searchSearch installed programs, package databases, system applications and configured program catalogs.
schedule7 poleceń
-
schedule.createCreate a schedule that runs a pipeline by cron expression, interval or time. -
schedule.historyList past runs of schedules with their result and journal operation. -
schedule.listList schedules with their next run and state. -
schedule.pausePause schedules without removing them. -
schedule.removeRemove schedules. -
schedule.resumeResume paused schedules. -
schedule.runRun the action of a schedule now, outside its times and run limit.
sysctl1 poleceń
-
sysctl.setSet a kernel parameter.
test4 poleceń
-
test.failedRun again only the tests that failed in an earlier run. -
test.listList earlier test runs. -
test.runRun the tests of a project and return typed results with a fingerprint of the code state. -
test.showShow the results of an earlier test run.
windows1 poleceń
-
windows.cimQuery CIM instances through WMI on Windows, or call a method of the selected instances with invoke.
Dokąd dalej
Strona o możliwościach grupuje polecenia według obiektu pracy, a strona o języku wyjaśnia, jak program jest sprawdzany. Książka kucharska i strony poleceń zawierają programy.