pterm 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -103,15 +103,16 @@ pterm stop start.js
103
103
 
104
104
  ## run
105
105
 
106
- Run a launcher. Equivalent to the user visiting a launcher page. Will run whichever script is the current default script.
106
+ Run a launcher. Equivalent to the user visiting a launcher page. By default it will run whichever script is the current launcher default. If the launcher exposes no explicit default, you can provide repeated `--default` selectors and Pinokio will match the first selector that exists in the launcher's current menu state.
107
107
 
108
108
  ### syntax
109
109
 
110
110
  ```
111
- pterm run <launcher_path_or_uri> [--open]
111
+ pterm run <launcher_path_or_uri> [--default <selector>]... [--open]
112
112
  ```
113
113
 
114
114
  - `--open`: (optional) open URL results in the browser. Default behavior is to print the URL to stdout without opening a browser.
115
+ - `--default`: (optional, repeatable) ordered launcher action selector. Each selector is matched against the current launcher menu. Selectors use launcher `href` syntax such as `run.js`, `install.js`, or `run.js?mode=Default`.
115
116
 
116
117
  ### examples
117
118
 
@@ -133,6 +134,21 @@ Run from a launcher URI and auto-open the resulting URL in browser
133
134
  pterm run https://github.com/example/my-launcher --open
134
135
  ```
135
136
 
137
+ Run a launcher with ordered fallback selectors when the launcher has no explicit default item
138
+
139
+ ```
140
+ pterm run ~/pinokio/api/facefusion-pinokio.git \
141
+ --default 'run.js?mode=Default' \
142
+ --default run.js \
143
+ --default install.js
144
+ ```
145
+
146
+ Launch a script directly with query parameters. Query parameters are passed through as script input automatically.
147
+
148
+ ```
149
+ pterm start 'run.js?mode=Default'
150
+ ```
151
+
136
152
  ## search
137
153
 
138
154
  Search installed or available apps.
package/index.js CHANGED
@@ -2,7 +2,12 @@
2
2
  const path = require('path')
3
3
  const yargs = require('yargs/yargs')
4
4
  const { hideBin } = require('yargs/helpers')
5
- const argv = yargs(hideBin(process.argv)).parse();
5
+ const argv = yargs(hideBin(process.argv))
6
+ .option('default', {
7
+ type: 'string',
8
+ array: true
9
+ })
10
+ .parse();
6
11
  const Script = require('./script')
7
12
  const Util = require('./util')
8
13
  const script = new Script();
@@ -89,7 +94,7 @@ const isHttpUri = (value) => typeof value === "string" && /^https?:\/\//i.test(v
89
94
  })
90
95
  }
91
96
  while(true) {
92
- let default_uri = await script.default_script(uri)
97
+ let default_uri = await script.default_script(uri, argv.default)
93
98
  if (default_uri) {
94
99
  if (path.isAbsolute(default_uri)) {
95
100
  await new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pterm",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/script.js CHANGED
@@ -30,7 +30,7 @@ class Script {
30
30
 
31
31
  return cleanup; // call this to stop listening
32
32
  }
33
- async default_script (uri) {
33
+ async default_script (uri, defaultSelectors) {
34
34
  const rpc = new RPC("ws://localhost:42000")
35
35
  const stop = () => {
36
36
  rpc.run({
@@ -55,6 +55,7 @@ class Script {
55
55
  rpc.run({
56
56
  uri,
57
57
  mode: "open",
58
+ default: Array.isArray(defaultSelectors) ? defaultSelectors : undefined,
58
59
  source: "pterm",
59
60
  client: {
60
61
  source: "pterm"