Interact with Pinokio through terminal commands
npm install -g pterm
prints the current version
pterm version <type>
type: may beterminal,pinokiod, orpinokioterminal: returns the pterm versionpinokiod: returns the pinokiod versionpinokio: returns the pinokio versionscript: returns the valid script version for the current client. used for including inpinokio.js
pterm version terminal
Start a pinokio script. Arguments can be passed into the script
pterm start <script_path> [<arg1>, <arg2>, ...]
Starting a script named install.js:
pterm start install.js
Starting a script named start.js with parameters:
pterm start start.js --port=3000 --model=google/gemma-3n-E4B-it
Above command starts the script start.js with the following args:
{
port: 3000,
model: "google/gemma-3n-E4B-it"
}
Which can be accessed in the start.js script, for example:
{
"daemon": true,
"run": [{
"method": "shell.run",
"params": {
"env": {
"PORT": "{{args.port}}"
},
"message": "python app.py --checkpoint={{args.model}}"
}
}]
}Stops a script if running:
pterm stop <script_path>
Stop the start.js script if it's running:
pterm stop start.js
Run a launcher. Equivalent to the user visiting a launcher page. Will run whichever script is the current default script.
pterm run <launcher_path>
Launch the launcher in the current path
pterm run .
Launch from absolute path
pterm run /pinokio/api/test
Display a file picker dialog, which lets the user select one or more file or folder paths, powered by tkinter.
This API is NOT for uploading the actual files but for submitting file paths.
pterm filepicker [<arg>, <arg>, ...]
Where args can be one of the following:
<arg>: script flags--title: (optional) file dialog title.--type: (optional) which type to select. Either "folder" or "file". If not specified, the value is "file".--path: (optional) specify path to open the file dialog from. If not specified, just use the default path.--multiple: (optional) whether to allow multiple path selection (trueorfalse). Default isfalse.--filetype: (optional) file types to accept. you can specify multiple--filetypeflags. The format must followtype/extension,extension,extension,...(Example:--filetype='image/*.png,*.jpg)
pterm filepicker --type=folder
The most basic command lets users select a single file:
pterm filepicker
which is equivalent to:
pterm filepicker --type=file
pterm filepicker --multiple
pterm filepicker --path=.
pterm filepicker --filetype='images/*.png,*.jpg,*.jpeg'
pterm filepicker --filetype='images/*.png,*.jpg,*.jpeg' --filetype='docs/*.pdf'
write to or read from clipboard
pterm clipboard copy <text>
pterm clipboard paste
The following command copies "hello world" to the clipboard
pterm clipboard copy "hello world"
Assuming the clipboard contains the text 'hello world',
pterm clipboard paste
will print:
hello world
You can pipe this to other terminal commands to easily access the clipboard content.
Send a desktop notification
pterm push <message> [<arg>, <arg>, ...]
message: a message to send<arg>: script flags--title: (optional) push notification title--subtitle: (optional) push notification subtitle--image: (optional) custom image path (can be both relative and absolute paths)--sound: (optional) true|false (default is false)--wait: (optional) wait for 5 seconds--timeout: (optional) wait for N seconds
pterm push 'hello world'
pterm push 'this is a notification' --sound
pterm push 'this is an image notification' --image=icon.png