Skip to content

Commit

Permalink
feat(developer): kmc-copy cleanup and documentation
Browse files Browse the repository at this point in the history
* Hides details on --rename and online sources for projects
  until implemented
  • Loading branch information
mcdurdin committed Oct 22, 2024
1 parent 089478d commit 6df121a
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 162 deletions.
68 changes: 68 additions & 0 deletions developer/docs/help/reference/kmc/cli/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ The following parameters are available:

: Rewrites On Screen Keyboard files from source mapping

`kmc copy origin -o target`

: Copy and rename a keyboard project

`kmc message [message...]`

: Describes one or more compiler messages in greater detail
Expand Down Expand Up @@ -294,6 +298,70 @@ For more information on the purpose of `analyze osk-char-use` and
`analyze rewrite-osk-from-char-use`, see
[`&displayMap`](/developer/language/reference/displaymap).

## `kmc copy` options

The input parameter should be one of the following:

* A .kpj file, e.g. `./keyboards/khmer_angkor/khmer_angkor.kpj`
* A local folder containing a .kpj file with the same base nam, e.g.
`./keyboards/khmer_angkor`
<!--
* A cloud keyboard, e.g. `cloud:khmer_angkor`
* A GitHub repository that matches the Keyman keyboard/model repository
layout, e.g. `github:keyman-keyboards/khmer_angkor`
-->

`-o, --out-path <filename>`

: The target folder to write the copied project. The folder must not exist.
The folder basename will become the ID of the new project, so the .kpj,
.kps, .kmn and similar files will be renamed to match that ID.

`-n, --dry-run`

: Show what would happen, without making changes

### File copying, renaming, and structure rules

The **origin** project folder is the one that contains the .kpj file. When a
project is copied, referenced files are reorganized into the
[recommended Keyman project folder structure](../../file-layout). (Note the
difference between **origin** and `/source`: `/source` is a normal subfolder
in the recommended Keyman project folder structure).

The destination project is called the **target**.

* The **id** of the project and files can be updated during the copy. The
**origin id** is the basename of the **origin** project file. The
**target id** is supplied as the `-o` parameter, and becomes both the name of
the output folder, and its basename becomes the basename of the **target**
project. If other files use the same basename, they will also be updated.
* All source-type files explicitly referenced in **origin** .kpj will be copied
to **target** `/source`, and references will be updated if the filename
changes. These are the source-type files:
* .kmn keyboard source
* .xml LDML keyboard source
* .kps package source
* .model.ts model source
* Files referenced by source-type files will be copied to **target** folder
structure, if they are also in the **origin** project folder. If the files are
outside the **origin** folder, then relative references will be updated.
* File references in .html and other files are not tracked.
* For version 1.0 projects, only files explicitly referenced in the project or
the source-type files are copied.
* For version 2.0 projects, all other files in the **origin** folder and
subfolders will also be copied to **target**, in the same relative location as
they were found in the **origin**. Files which have a **origin id** basename
will also be renamed to use the **target id** basename (be aware that this
could break untracked references).
* If a referenced file does not exist, for example the compiled files referenced
in a .kps file may not be present, the references will still be updated
following the rules above.
* Unreferenced files in the **origin** project's `build/` folder will not be
copied.
* .kpj.user files will not be copied.
* .kpj options will be updated to use fixed `source/` and `build/` folders.

## `kmc message` options

One or more message identifiers can be specified for text or json formats.
Expand Down
Loading

0 comments on commit 6df121a

Please sign in to comment.