Gå til hovedinnhold

kapi add

kapi add <pattern> [pattern...]

Add file patterns to this project's content so kapi knows which files to process. Patterns support ** for recursive matching. Format is auto-detected from the extension unless --format is given.

By default each pattern becomes a bare entry, which the project's default point governs. --name puts them in a named collection instead, and --channel binds that collection to a point in the context space (profile/channel), so a surface is governed by the voice that suits it rather than by the project default. Adding to a name that already exists extends that collection.

--target declares where a translated file goes: a template over {lang} and the path tokens ({path}, {name}, {ext}), or a directory to mirror into. Without one a flow that writes has nowhere of its own to write, so give it here rather than by hand-editing the recipe. A target that lands back inside the pattern it comes from is refused: the collection would re-track its own output as source. On a pattern the project already tracks, --target sets the target its entry lacks; an entry that already declares another target is refused, with the recipe change to make instead. A file belongs to the first entry in the recipe whose pattern matches it, so a target applies to the files its entry claims. The output names each other file and the entry that claims it, and a pattern an earlier entry claims every file of is refused. Under a named collection with a base, the target is given from the project root and kept relative to the base.

kapi add "src//.html" kapi add "locales/.json" --format json kapi add "src//.html" "content/**/.md" kapi add "docs//*.md" --target "translated/{lang}/{path}.md" kapi add "support//*.md" --name northsea-support --channel northsea/docs

Commandadd
Groupwork
Try it

Runs in your browser against a small sample file. Edit the command before running, or press Run to execute it as shown.

kapi add
Flags
FlagTypeDefaultDescription
--channel stringknytt den navngitte samlingen til et punkt i kontekstrommet (profil/kanal)
--color stringautofargelegg utdata: auto, always, never
--format , -fstringfilformat (f.eks. html, json); registreres automatisk hvis utelatt
--jq stringfiltrer JSON-utdata gjennom et jq-uttrykk (innebærer --json)
--json boolfalseUtdata i JSON-format
--name stringplasser mønstrene i en navngitt samling (opprettes, eller utvides hvis den finnes)
--output-format stringUtdataformat: text (alias: table), json, yaml
--project , -pstringsti til en kapi.yaml-prosjektoppskrift eller dens katalog (oppdages automatisk fra cwd hvis utelatt)
--target stringhvor oversatte filer lagres: en mal over {lang} og stiTokenene, eller en katalog å speile inn i
--text boolfalseSkriv ut i tekstformat (standard)

← Back to the Command Reference