pterm
v0.0.14
Published
Interact with Pinokio through terminal commands
Readme
Pinokio Terminal
Interact with Pinokio through terminal commands
Install
npm install -g ptermUsage
version
prints the current version
syntax
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
example
pterm version terminalstart
Start a pinokio script. Arguments can be passed into the script
syntax
pterm start <script_path> [<arg1>, <arg2>, ...]examples
Starting a script named install.js:
pterm start install.jsStarting a script named start.js with parameters:
pterm start start.js --port=3000 --model=google/gemma-3n-E4B-itAbove 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}}"
}
}]
}stop
Stops a script if running:
syntax
pterm stop <script_path>example
Stop the start.js script if it's running:
pterm stop start.jsrun
Run a launcher. Equivalent to the user visiting a launcher page. Will run whichever script is the current default script.
syntax
pterm run <launcher_path>examples
Launch the launcher in the current path
pterm run .Launch from absolute path
pterm run /pinokio/api/testfilepicker
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.
syntax
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)
examples
Select a folder path
pterm filepicker --type=folderSelect a file path
The most basic command lets users select a single file:
pterm filepickerwhich is equivalent to:
pterm filepicker --type=fileSelect multiple files
pterm filepicker --multipleOpen the filepicker from the current path
pterm filepicker --path=.Open an image filepicker
pterm filepicker --filetype='images/*.png,*.jpg,*.jpeg'Open a filepicker with multiple file types
pterm filepicker --filetype='images/*.png,*.jpg,*.jpeg' --filetype='docs/*.pdf'clipboard
write to or read from clipboard
syntax
pterm clipboard copy <text>
pterm clipboard pasteexamples
copy text to clipboard
The following command copies "hello world" to the clipboard
pterm clipboard copy "hello world"read from clipboard
Assuming the clipboard contains the text 'hello world',
pterm clipboard pastewill print:
hello worldYou can pipe this to other terminal commands to easily access the clipboard content.
push
Send a desktop notification
syntax
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
examples
send a simple notification
pterm push 'hello world'notification with sound
pterm push 'this is a notification' --soundnotification with an image
pterm push 'this is an image notification' --image=icon.png