Run a project
A project is a folder with a project file, ztcl.project, that names its first script, its files, and its capabilities. ztk run starts the project of the current folder:
cd examples/usecases/csv-window
ztk run sample/bank.csv
The project file is the one of ztcl. Projects in the docs of ztcl has each key. An app has the kind app:
format 1
kind app
name csv-window
version 0.1.0
tcl 9.1
main csv-window.tcl
files {csvlib.tcl}
data {sample}
allow {file channels clock}
How ztk run works
- ztk reads
ztcl.projectand runs no script for it. A key that ztcl does not know, or a key given two times, is an error with its line. - The files of
main,files, anddatago into a payload, the same one asztk bundlemakes. The program sees them at//zipfs:/app/, read-only, so[file dirname [info script]]andsourcefind the files of the project. A file that the project file does not list is not there. - The app has the capabilities of
allow, and no other: also not the defaults of ztk.ztk run --allowis an error, so the project file is the one list of the capabilities. - The flags of ztk come after
run, such as--headless,--dark, or--root DIR. The first word that is not a flag of ztk starts the words of the script:ztk run --root . -demogives-demoto the script.
The examples
Each example of examples/usecases/ is a project:
| Folder | Command |
|---|---|
csv-window |
ztk run sample/bank.csv |
log-dashboard |
ztk run --root . app.log |
plugin-host |
ztk run --root . |
--root . keeps the file commands in the folder. The plugin host needs it: a plugin runs in a child process, and a plugin with file reads only the root folder.