@loopress/cli 0.1.0 → 0.2.0
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 +122 -139
- package/dist/commands/snippets/list.d.ts +1 -1
- package/dist/commands/snippets/list.js +1 -1
- package/dist/commands/snippets/pull.d.ts +1 -1
- package/dist/commands/snippets/pull.js +55 -3
- package/dist/commands/snippets/push.d.ts +1 -1
- package/dist/commands/snippets/push.js +1 -1
- package/dist/commands/styles/pull.d.ts +1 -1
- package/dist/commands/styles/pull.js +1 -1
- package/dist/commands/styles/push.d.ts +1 -1
- package/dist/commands/styles/push.js +1 -1
- package/dist/help.d.ts +4 -0
- package/dist/help.js +22 -0
- package/dist/utils/snippet-plugin.d.ts +2 -0
- package/dist/utils/snippet-plugin.js +18 -0
- package/oclif.manifest.json +1 -45
- package/package.json +5 -2
- /package/dist/{commands → lib}/base.d.ts +0 -0
- /package/dist/{commands → lib}/base.js +0 -0
package/README.md
CHANGED
|
@@ -17,65 +17,50 @@ A new CLI generated with oclif
|
|
|
17
17
|
<!-- usage -->
|
|
18
18
|
```sh-session
|
|
19
19
|
$ npm install -g @loopress/cli
|
|
20
|
-
$
|
|
20
|
+
$ lps COMMAND
|
|
21
21
|
running command...
|
|
22
|
-
$
|
|
23
|
-
@loopress/cli/0.
|
|
24
|
-
$
|
|
22
|
+
$ lps (--version)
|
|
23
|
+
@loopress/cli/0.2.0 linux-x64 node-v24.16.0
|
|
24
|
+
$ lps --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
|
-
$
|
|
26
|
+
$ lps COMMAND
|
|
27
27
|
...
|
|
28
28
|
```
|
|
29
29
|
<!-- usagestop -->
|
|
30
30
|
# Commands
|
|
31
31
|
<!-- commands -->
|
|
32
|
-
* [
|
|
33
|
-
* [
|
|
34
|
-
* [
|
|
35
|
-
* [
|
|
36
|
-
* [
|
|
37
|
-
* [
|
|
38
|
-
* [
|
|
39
|
-
* [
|
|
40
|
-
* [
|
|
41
|
-
* [
|
|
42
|
-
* [
|
|
43
|
-
* [
|
|
44
|
-
* [
|
|
45
|
-
* [
|
|
46
|
-
* [
|
|
47
|
-
* [
|
|
48
|
-
* [
|
|
49
|
-
* [
|
|
50
|
-
* [
|
|
51
|
-
* [
|
|
52
|
-
* [
|
|
53
|
-
* [
|
|
54
|
-
* [
|
|
55
|
-
* [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
* [`lps help [COMMAND]`](#lps-help-command)
|
|
33
|
+
* [`lps login`](#lps-login)
|
|
34
|
+
* [`lps logout`](#lps-logout)
|
|
35
|
+
* [`lps plugins`](#lps-plugins)
|
|
36
|
+
* [`lps plugins add PLUGIN`](#lps-plugins-add-plugin)
|
|
37
|
+
* [`lps plugins:inspect PLUGIN...`](#lps-pluginsinspect-plugin)
|
|
38
|
+
* [`lps plugins install PLUGIN`](#lps-plugins-install-plugin)
|
|
39
|
+
* [`lps plugins link PATH`](#lps-plugins-link-path)
|
|
40
|
+
* [`lps plugins remove [PLUGIN]`](#lps-plugins-remove-plugin)
|
|
41
|
+
* [`lps plugins reset`](#lps-plugins-reset)
|
|
42
|
+
* [`lps plugins uninstall [PLUGIN]`](#lps-plugins-uninstall-plugin)
|
|
43
|
+
* [`lps plugins unlink [PLUGIN]`](#lps-plugins-unlink-plugin)
|
|
44
|
+
* [`lps plugins update`](#lps-plugins-update)
|
|
45
|
+
* [`lps project config`](#lps-project-config)
|
|
46
|
+
* [`lps project list`](#lps-project-list)
|
|
47
|
+
* [`lps project remove`](#lps-project-remove)
|
|
48
|
+
* [`lps project remove-env`](#lps-project-remove-env)
|
|
49
|
+
* [`lps project switch`](#lps-project-switch)
|
|
50
|
+
* [`lps project switch-env`](#lps-project-switch-env)
|
|
51
|
+
* [`lps snippets list`](#lps-snippets-list)
|
|
52
|
+
* [`lps snippets pull [PATH]`](#lps-snippets-pull-path)
|
|
53
|
+
* [`lps snippets push [PATH]`](#lps-snippets-push-path)
|
|
54
|
+
* [`lps styles pull`](#lps-styles-pull)
|
|
55
|
+
* [`lps styles push`](#lps-styles-push)
|
|
56
|
+
|
|
57
|
+
## `lps help [COMMAND]`
|
|
58
|
+
|
|
59
|
+
Display help for lps.
|
|
59
60
|
|
|
60
61
|
```
|
|
61
62
|
USAGE
|
|
62
|
-
$
|
|
63
|
-
|
|
64
|
-
GLOBAL FLAGS
|
|
65
|
-
--password=<value> WordPress application password (fallback; prefer `lps project config`)
|
|
66
|
-
--url=<value> WordPress URL (fallback; prefer `lps project config`)
|
|
67
|
-
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
_See code: [src/commands/base.ts](https://github.com/loopress/loopress/blob/v0.1.0/src/commands/base.ts)_
|
|
71
|
-
|
|
72
|
-
## `@loopress/cli help [COMMAND]`
|
|
73
|
-
|
|
74
|
-
Display help for @loopress/cli.
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
USAGE
|
|
78
|
-
$ @loopress/cli help [COMMAND...] [-n]
|
|
63
|
+
$ lps help [COMMAND...] [-n]
|
|
79
64
|
|
|
80
65
|
ARGUMENTS
|
|
81
66
|
[COMMAND...] Command to show help for.
|
|
@@ -84,18 +69,18 @@ FLAGS
|
|
|
84
69
|
-n, --nested-commands Include all nested commands in the output.
|
|
85
70
|
|
|
86
71
|
DESCRIPTION
|
|
87
|
-
Display help for
|
|
72
|
+
Display help for lps.
|
|
88
73
|
```
|
|
89
74
|
|
|
90
75
|
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.50/src/commands/help.ts)_
|
|
91
76
|
|
|
92
|
-
##
|
|
77
|
+
## `lps login`
|
|
93
78
|
|
|
94
79
|
Log in to Loopress via the console
|
|
95
80
|
|
|
96
81
|
```
|
|
97
82
|
USAGE
|
|
98
|
-
$
|
|
83
|
+
$ lps login
|
|
99
84
|
|
|
100
85
|
DESCRIPTION
|
|
101
86
|
Log in to Loopress via the console
|
|
@@ -104,15 +89,15 @@ EXAMPLES
|
|
|
104
89
|
$ lps login
|
|
105
90
|
```
|
|
106
91
|
|
|
107
|
-
_See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.
|
|
92
|
+
_See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/login.ts)_
|
|
108
93
|
|
|
109
|
-
##
|
|
94
|
+
## `lps logout`
|
|
110
95
|
|
|
111
96
|
Log out from Loopress console
|
|
112
97
|
|
|
113
98
|
```
|
|
114
99
|
USAGE
|
|
115
|
-
$
|
|
100
|
+
$ lps logout
|
|
116
101
|
|
|
117
102
|
DESCRIPTION
|
|
118
103
|
Log out from Loopress console
|
|
@@ -121,15 +106,15 @@ EXAMPLES
|
|
|
121
106
|
$ lps logout
|
|
122
107
|
```
|
|
123
108
|
|
|
124
|
-
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.
|
|
109
|
+
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/logout.ts)_
|
|
125
110
|
|
|
126
|
-
##
|
|
111
|
+
## `lps plugins`
|
|
127
112
|
|
|
128
113
|
List installed plugins.
|
|
129
114
|
|
|
130
115
|
```
|
|
131
116
|
USAGE
|
|
132
|
-
$
|
|
117
|
+
$ lps plugins [--json] [--core]
|
|
133
118
|
|
|
134
119
|
FLAGS
|
|
135
120
|
--core Show core plugins.
|
|
@@ -141,18 +126,18 @@ DESCRIPTION
|
|
|
141
126
|
List installed plugins.
|
|
142
127
|
|
|
143
128
|
EXAMPLES
|
|
144
|
-
$
|
|
129
|
+
$ lps plugins
|
|
145
130
|
```
|
|
146
131
|
|
|
147
132
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/index.ts)_
|
|
148
133
|
|
|
149
|
-
##
|
|
134
|
+
## `lps plugins add PLUGIN`
|
|
150
135
|
|
|
151
|
-
Installs a plugin into
|
|
136
|
+
Installs a plugin into lps.
|
|
152
137
|
|
|
153
138
|
```
|
|
154
139
|
USAGE
|
|
155
|
-
$
|
|
140
|
+
$ lps plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
156
141
|
|
|
157
142
|
ARGUMENTS
|
|
158
143
|
PLUGIN... Plugin to install.
|
|
@@ -167,39 +152,39 @@ GLOBAL FLAGS
|
|
|
167
152
|
--json Format output as json.
|
|
168
153
|
|
|
169
154
|
DESCRIPTION
|
|
170
|
-
Installs a plugin into
|
|
155
|
+
Installs a plugin into lps.
|
|
171
156
|
|
|
172
157
|
Uses npm to install plugins.
|
|
173
158
|
|
|
174
159
|
Installation of a user-installed plugin will override a core plugin.
|
|
175
160
|
|
|
176
|
-
Use the
|
|
177
|
-
Use the
|
|
161
|
+
Use the LPS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
|
162
|
+
Use the LPS_NPM_REGISTRY environment variable to set the npm registry.
|
|
178
163
|
|
|
179
164
|
ALIASES
|
|
180
|
-
$
|
|
165
|
+
$ lps plugins add
|
|
181
166
|
|
|
182
167
|
EXAMPLES
|
|
183
168
|
Install a plugin from npm registry.
|
|
184
169
|
|
|
185
|
-
$
|
|
170
|
+
$ lps plugins add myplugin
|
|
186
171
|
|
|
187
172
|
Install a plugin from a github url.
|
|
188
173
|
|
|
189
|
-
$
|
|
174
|
+
$ lps plugins add https://github.com/someuser/someplugin
|
|
190
175
|
|
|
191
176
|
Install a plugin from a github slug.
|
|
192
177
|
|
|
193
|
-
$
|
|
178
|
+
$ lps plugins add someuser/someplugin
|
|
194
179
|
```
|
|
195
180
|
|
|
196
|
-
##
|
|
181
|
+
## `lps plugins:inspect PLUGIN...`
|
|
197
182
|
|
|
198
183
|
Displays installation properties of a plugin.
|
|
199
184
|
|
|
200
185
|
```
|
|
201
186
|
USAGE
|
|
202
|
-
$
|
|
187
|
+
$ lps plugins inspect PLUGIN...
|
|
203
188
|
|
|
204
189
|
ARGUMENTS
|
|
205
190
|
PLUGIN... [default: .] Plugin to inspect.
|
|
@@ -215,18 +200,18 @@ DESCRIPTION
|
|
|
215
200
|
Displays installation properties of a plugin.
|
|
216
201
|
|
|
217
202
|
EXAMPLES
|
|
218
|
-
$
|
|
203
|
+
$ lps plugins inspect myplugin
|
|
219
204
|
```
|
|
220
205
|
|
|
221
206
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/inspect.ts)_
|
|
222
207
|
|
|
223
|
-
##
|
|
208
|
+
## `lps plugins install PLUGIN`
|
|
224
209
|
|
|
225
|
-
Installs a plugin into
|
|
210
|
+
Installs a plugin into lps.
|
|
226
211
|
|
|
227
212
|
```
|
|
228
213
|
USAGE
|
|
229
|
-
$
|
|
214
|
+
$ lps plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
230
215
|
|
|
231
216
|
ARGUMENTS
|
|
232
217
|
PLUGIN... Plugin to install.
|
|
@@ -241,41 +226,41 @@ GLOBAL FLAGS
|
|
|
241
226
|
--json Format output as json.
|
|
242
227
|
|
|
243
228
|
DESCRIPTION
|
|
244
|
-
Installs a plugin into
|
|
229
|
+
Installs a plugin into lps.
|
|
245
230
|
|
|
246
231
|
Uses npm to install plugins.
|
|
247
232
|
|
|
248
233
|
Installation of a user-installed plugin will override a core plugin.
|
|
249
234
|
|
|
250
|
-
Use the
|
|
251
|
-
Use the
|
|
235
|
+
Use the LPS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
|
236
|
+
Use the LPS_NPM_REGISTRY environment variable to set the npm registry.
|
|
252
237
|
|
|
253
238
|
ALIASES
|
|
254
|
-
$
|
|
239
|
+
$ lps plugins add
|
|
255
240
|
|
|
256
241
|
EXAMPLES
|
|
257
242
|
Install a plugin from npm registry.
|
|
258
243
|
|
|
259
|
-
$
|
|
244
|
+
$ lps plugins install myplugin
|
|
260
245
|
|
|
261
246
|
Install a plugin from a github url.
|
|
262
247
|
|
|
263
|
-
$
|
|
248
|
+
$ lps plugins install https://github.com/someuser/someplugin
|
|
264
249
|
|
|
265
250
|
Install a plugin from a github slug.
|
|
266
251
|
|
|
267
|
-
$
|
|
252
|
+
$ lps plugins install someuser/someplugin
|
|
268
253
|
```
|
|
269
254
|
|
|
270
255
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/install.ts)_
|
|
271
256
|
|
|
272
|
-
##
|
|
257
|
+
## `lps plugins link PATH`
|
|
273
258
|
|
|
274
259
|
Links a plugin into the CLI for development.
|
|
275
260
|
|
|
276
261
|
```
|
|
277
262
|
USAGE
|
|
278
|
-
$
|
|
263
|
+
$ lps plugins link PATH [-h] [--install] [-v]
|
|
279
264
|
|
|
280
265
|
ARGUMENTS
|
|
281
266
|
PATH [default: .] path to plugin
|
|
@@ -295,18 +280,18 @@ DESCRIPTION
|
|
|
295
280
|
|
|
296
281
|
|
|
297
282
|
EXAMPLES
|
|
298
|
-
$
|
|
283
|
+
$ lps plugins link myplugin
|
|
299
284
|
```
|
|
300
285
|
|
|
301
286
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/link.ts)_
|
|
302
287
|
|
|
303
|
-
##
|
|
288
|
+
## `lps plugins remove [PLUGIN]`
|
|
304
289
|
|
|
305
290
|
Removes a plugin from the CLI.
|
|
306
291
|
|
|
307
292
|
```
|
|
308
293
|
USAGE
|
|
309
|
-
$
|
|
294
|
+
$ lps plugins remove [PLUGIN...] [-h] [-v]
|
|
310
295
|
|
|
311
296
|
ARGUMENTS
|
|
312
297
|
[PLUGIN...] plugin to uninstall
|
|
@@ -319,20 +304,20 @@ DESCRIPTION
|
|
|
319
304
|
Removes a plugin from the CLI.
|
|
320
305
|
|
|
321
306
|
ALIASES
|
|
322
|
-
$
|
|
323
|
-
$
|
|
307
|
+
$ lps plugins unlink
|
|
308
|
+
$ lps plugins remove
|
|
324
309
|
|
|
325
310
|
EXAMPLES
|
|
326
|
-
$
|
|
311
|
+
$ lps plugins remove myplugin
|
|
327
312
|
```
|
|
328
313
|
|
|
329
|
-
##
|
|
314
|
+
## `lps plugins reset`
|
|
330
315
|
|
|
331
316
|
Remove all user-installed and linked plugins.
|
|
332
317
|
|
|
333
318
|
```
|
|
334
319
|
USAGE
|
|
335
|
-
$
|
|
320
|
+
$ lps plugins reset [--hard] [--reinstall]
|
|
336
321
|
|
|
337
322
|
FLAGS
|
|
338
323
|
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
|
|
@@ -341,13 +326,13 @@ FLAGS
|
|
|
341
326
|
|
|
342
327
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/reset.ts)_
|
|
343
328
|
|
|
344
|
-
##
|
|
329
|
+
## `lps plugins uninstall [PLUGIN]`
|
|
345
330
|
|
|
346
331
|
Removes a plugin from the CLI.
|
|
347
332
|
|
|
348
333
|
```
|
|
349
334
|
USAGE
|
|
350
|
-
$
|
|
335
|
+
$ lps plugins uninstall [PLUGIN...] [-h] [-v]
|
|
351
336
|
|
|
352
337
|
ARGUMENTS
|
|
353
338
|
[PLUGIN...] plugin to uninstall
|
|
@@ -360,22 +345,22 @@ DESCRIPTION
|
|
|
360
345
|
Removes a plugin from the CLI.
|
|
361
346
|
|
|
362
347
|
ALIASES
|
|
363
|
-
$
|
|
364
|
-
$
|
|
348
|
+
$ lps plugins unlink
|
|
349
|
+
$ lps plugins remove
|
|
365
350
|
|
|
366
351
|
EXAMPLES
|
|
367
|
-
$
|
|
352
|
+
$ lps plugins uninstall myplugin
|
|
368
353
|
```
|
|
369
354
|
|
|
370
355
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/uninstall.ts)_
|
|
371
356
|
|
|
372
|
-
##
|
|
357
|
+
## `lps plugins unlink [PLUGIN]`
|
|
373
358
|
|
|
374
359
|
Removes a plugin from the CLI.
|
|
375
360
|
|
|
376
361
|
```
|
|
377
362
|
USAGE
|
|
378
|
-
$
|
|
363
|
+
$ lps plugins unlink [PLUGIN...] [-h] [-v]
|
|
379
364
|
|
|
380
365
|
ARGUMENTS
|
|
381
366
|
[PLUGIN...] plugin to uninstall
|
|
@@ -388,20 +373,20 @@ DESCRIPTION
|
|
|
388
373
|
Removes a plugin from the CLI.
|
|
389
374
|
|
|
390
375
|
ALIASES
|
|
391
|
-
$
|
|
392
|
-
$
|
|
376
|
+
$ lps plugins unlink
|
|
377
|
+
$ lps plugins remove
|
|
393
378
|
|
|
394
379
|
EXAMPLES
|
|
395
|
-
$
|
|
380
|
+
$ lps plugins unlink myplugin
|
|
396
381
|
```
|
|
397
382
|
|
|
398
|
-
##
|
|
383
|
+
## `lps plugins update`
|
|
399
384
|
|
|
400
385
|
Update installed plugins.
|
|
401
386
|
|
|
402
387
|
```
|
|
403
388
|
USAGE
|
|
404
|
-
$
|
|
389
|
+
$ lps plugins update [-h] [-v]
|
|
405
390
|
|
|
406
391
|
FLAGS
|
|
407
392
|
-h, --help Show CLI help.
|
|
@@ -413,13 +398,13 @@ DESCRIPTION
|
|
|
413
398
|
|
|
414
399
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/update.ts)_
|
|
415
400
|
|
|
416
|
-
##
|
|
401
|
+
## `lps project config`
|
|
417
402
|
|
|
418
403
|
Add or update a WordPress project environment
|
|
419
404
|
|
|
420
405
|
```
|
|
421
406
|
USAGE
|
|
422
|
-
$
|
|
407
|
+
$ lps project config
|
|
423
408
|
|
|
424
409
|
DESCRIPTION
|
|
425
410
|
Add or update a WordPress project environment
|
|
@@ -428,15 +413,15 @@ EXAMPLES
|
|
|
428
413
|
$ lps project config
|
|
429
414
|
```
|
|
430
415
|
|
|
431
|
-
_See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.
|
|
416
|
+
_See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/config.ts)_
|
|
432
417
|
|
|
433
|
-
##
|
|
418
|
+
## `lps project list`
|
|
434
419
|
|
|
435
420
|
List configured WordPress projects
|
|
436
421
|
|
|
437
422
|
```
|
|
438
423
|
USAGE
|
|
439
|
-
$
|
|
424
|
+
$ lps project list
|
|
440
425
|
|
|
441
426
|
DESCRIPTION
|
|
442
427
|
List configured WordPress projects
|
|
@@ -445,15 +430,15 @@ EXAMPLES
|
|
|
445
430
|
$ lps project list
|
|
446
431
|
```
|
|
447
432
|
|
|
448
|
-
_See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.
|
|
433
|
+
_See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/list.ts)_
|
|
449
434
|
|
|
450
|
-
##
|
|
435
|
+
## `lps project remove`
|
|
451
436
|
|
|
452
437
|
Remove one or more WordPress project configurations
|
|
453
438
|
|
|
454
439
|
```
|
|
455
440
|
USAGE
|
|
456
|
-
$
|
|
441
|
+
$ lps project remove
|
|
457
442
|
|
|
458
443
|
DESCRIPTION
|
|
459
444
|
Remove one or more WordPress project configurations
|
|
@@ -462,15 +447,15 @@ EXAMPLES
|
|
|
462
447
|
$ lps project remove
|
|
463
448
|
```
|
|
464
449
|
|
|
465
|
-
_See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.
|
|
450
|
+
_See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/remove.ts)_
|
|
466
451
|
|
|
467
|
-
##
|
|
452
|
+
## `lps project remove-env`
|
|
468
453
|
|
|
469
454
|
Remove one or more environments from the current project
|
|
470
455
|
|
|
471
456
|
```
|
|
472
457
|
USAGE
|
|
473
|
-
$
|
|
458
|
+
$ lps project remove-env
|
|
474
459
|
|
|
475
460
|
DESCRIPTION
|
|
476
461
|
Remove one or more environments from the current project
|
|
@@ -479,15 +464,15 @@ EXAMPLES
|
|
|
479
464
|
$ lps project remove-env
|
|
480
465
|
```
|
|
481
466
|
|
|
482
|
-
_See code: [src/commands/project/remove-env.ts](https://github.com/loopress/loopress/blob/v0.
|
|
467
|
+
_See code: [src/commands/project/remove-env.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/remove-env.ts)_
|
|
483
468
|
|
|
484
|
-
##
|
|
469
|
+
## `lps project switch`
|
|
485
470
|
|
|
486
471
|
Switch the active project
|
|
487
472
|
|
|
488
473
|
```
|
|
489
474
|
USAGE
|
|
490
|
-
$
|
|
475
|
+
$ lps project switch
|
|
491
476
|
|
|
492
477
|
DESCRIPTION
|
|
493
478
|
Switch the active project
|
|
@@ -496,15 +481,15 @@ EXAMPLES
|
|
|
496
481
|
$ lps project switch
|
|
497
482
|
```
|
|
498
483
|
|
|
499
|
-
_See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.
|
|
484
|
+
_See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/switch.ts)_
|
|
500
485
|
|
|
501
|
-
##
|
|
486
|
+
## `lps project switch-env`
|
|
502
487
|
|
|
503
488
|
Switch the active environment within the current project
|
|
504
489
|
|
|
505
490
|
```
|
|
506
491
|
USAGE
|
|
507
|
-
$
|
|
492
|
+
$ lps project switch-env
|
|
508
493
|
|
|
509
494
|
DESCRIPTION
|
|
510
495
|
Switch the active environment within the current project
|
|
@@ -513,15 +498,15 @@ EXAMPLES
|
|
|
513
498
|
$ lps project switch-env
|
|
514
499
|
```
|
|
515
500
|
|
|
516
|
-
_See code: [src/commands/project/switch-env.ts](https://github.com/loopress/loopress/blob/v0.
|
|
501
|
+
_See code: [src/commands/project/switch-env.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/switch-env.ts)_
|
|
517
502
|
|
|
518
|
-
##
|
|
503
|
+
## `lps snippets list`
|
|
519
504
|
|
|
520
505
|
List snippets from WordPress
|
|
521
506
|
|
|
522
507
|
```
|
|
523
508
|
USAGE
|
|
524
|
-
$
|
|
509
|
+
$ lps snippets list [--password <value>] [--url <value>] [--user <value>] [-j] [-p code-snippets|wpcode]
|
|
525
510
|
|
|
526
511
|
FLAGS
|
|
527
512
|
-j, --json Output in JSON format
|
|
@@ -544,16 +529,15 @@ EXAMPLES
|
|
|
544
529
|
$ lps snippets list --plugin wpcode
|
|
545
530
|
```
|
|
546
531
|
|
|
547
|
-
_See code: [src/commands/snippets/list.ts](https://github.com/loopress/loopress/blob/v0.
|
|
532
|
+
_See code: [src/commands/snippets/list.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/snippets/list.ts)_
|
|
548
533
|
|
|
549
|
-
##
|
|
534
|
+
## `lps snippets pull [PATH]`
|
|
550
535
|
|
|
551
536
|
Pull snippets from WordPress
|
|
552
537
|
|
|
553
538
|
```
|
|
554
539
|
USAGE
|
|
555
|
-
$
|
|
556
|
-
code-snippets|wpcode]
|
|
540
|
+
$ lps snippets pull [PATH] [--password <value>] [--url <value>] [--user <value>] [-d] [-p code-snippets|wpcode]
|
|
557
541
|
|
|
558
542
|
ARGUMENTS
|
|
559
543
|
[PATH] Path to snippets directory (overrides project config)
|
|
@@ -581,16 +565,15 @@ EXAMPLES
|
|
|
581
565
|
$ lps snippets pull --plugin wpcode
|
|
582
566
|
```
|
|
583
567
|
|
|
584
|
-
_See code: [src/commands/snippets/pull.ts](https://github.com/loopress/loopress/blob/v0.
|
|
568
|
+
_See code: [src/commands/snippets/pull.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/snippets/pull.ts)_
|
|
585
569
|
|
|
586
|
-
##
|
|
570
|
+
## `lps snippets push [PATH]`
|
|
587
571
|
|
|
588
572
|
Push snippets to WordPress
|
|
589
573
|
|
|
590
574
|
```
|
|
591
575
|
USAGE
|
|
592
|
-
$
|
|
593
|
-
code-snippets|wpcode]
|
|
576
|
+
$ lps snippets push [PATH] [--password <value>] [--url <value>] [--user <value>] [-d] [-p code-snippets|wpcode]
|
|
594
577
|
|
|
595
578
|
ARGUMENTS
|
|
596
579
|
[PATH] Path to snippets directory (overrides project config)
|
|
@@ -618,15 +601,15 @@ EXAMPLES
|
|
|
618
601
|
$ lps snippets push --plugin wpcode
|
|
619
602
|
```
|
|
620
603
|
|
|
621
|
-
_See code: [src/commands/snippets/push.ts](https://github.com/loopress/loopress/blob/v0.
|
|
604
|
+
_See code: [src/commands/snippets/push.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/snippets/push.ts)_
|
|
622
605
|
|
|
623
|
-
##
|
|
606
|
+
## `lps styles pull`
|
|
624
607
|
|
|
625
608
|
Pull Global Styles from WordPress
|
|
626
609
|
|
|
627
610
|
```
|
|
628
611
|
USAGE
|
|
629
|
-
$
|
|
612
|
+
$ lps styles pull [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
630
613
|
|
|
631
614
|
FLAGS
|
|
632
615
|
-d, --dryRun Dry run - show what would happen without making changes
|
|
@@ -645,15 +628,15 @@ EXAMPLES
|
|
|
645
628
|
$ lps styles pull --url http://example.com
|
|
646
629
|
```
|
|
647
630
|
|
|
648
|
-
_See code: [src/commands/styles/pull.ts](https://github.com/loopress/loopress/blob/v0.
|
|
631
|
+
_See code: [src/commands/styles/pull.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/styles/pull.ts)_
|
|
649
632
|
|
|
650
|
-
##
|
|
633
|
+
## `lps styles push`
|
|
651
634
|
|
|
652
635
|
Push Global Styles to WordPress
|
|
653
636
|
|
|
654
637
|
```
|
|
655
638
|
USAGE
|
|
656
|
-
$
|
|
639
|
+
$ lps styles push [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
657
640
|
|
|
658
641
|
FLAGS
|
|
659
642
|
-d, --dryRun Dry run - show what would happen without making changes
|
|
@@ -672,5 +655,5 @@ EXAMPLES
|
|
|
672
655
|
$ lps styles push --url http://example.com
|
|
673
656
|
```
|
|
674
657
|
|
|
675
|
-
_See code: [src/commands/styles/push.ts](https://github.com/loopress/loopress/blob/v0.
|
|
658
|
+
_See code: [src/commands/styles/push.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/styles/push.ts)_
|
|
676
659
|
<!-- commandsstop -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import got from 'got';
|
|
3
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
3
4
|
import { getSnippetPlugin } from '../../utils/snippet-plugin.js';
|
|
4
|
-
import { LoopressCommand } from '../base.js';
|
|
5
5
|
export default class List extends LoopressCommand {
|
|
6
6
|
static description = 'List snippets from WordPress';
|
|
7
7
|
static examples = [
|
|
@@ -1,7 +1,48 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import got from 'got';
|
|
3
|
+
import slugify from 'slugify';
|
|
4
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
3
5
|
import { getSnippetPlugin } from '../../utils/snippet-plugin.js';
|
|
4
|
-
|
|
6
|
+
const EXTENSIONS = {
|
|
7
|
+
css: 'css',
|
|
8
|
+
html: 'html',
|
|
9
|
+
js: 'js',
|
|
10
|
+
php: 'php',
|
|
11
|
+
text: 'txt',
|
|
12
|
+
};
|
|
13
|
+
const sanitize = (value) => value.replaceAll(/\s*\n\s*/g, ' ').trim();
|
|
14
|
+
function buildMetaLines(snippet) {
|
|
15
|
+
return [
|
|
16
|
+
`name: ${sanitize(snippet.name)}`,
|
|
17
|
+
...(snippet.description ? [`description: ${sanitize(snippet.description)}`] : []),
|
|
18
|
+
`type: ${snippet.type}`,
|
|
19
|
+
...(snippet.tags.length > 0 ? [`tags: ${snippet.tags.map((t) => sanitize(t)).join(', ')}`] : []),
|
|
20
|
+
`active: ${snippet.active}`,
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
function buildSnippetFile(snippet) {
|
|
24
|
+
const meta = buildMetaLines(snippet);
|
|
25
|
+
switch (snippet.type) {
|
|
26
|
+
case 'css':
|
|
27
|
+
case 'js': {
|
|
28
|
+
const header = ['/**', ...meta.map((l) => ` * ${l}`), ' */'].join('\n');
|
|
29
|
+
return `${header}\n\n${snippet.code}`;
|
|
30
|
+
}
|
|
31
|
+
case 'html': {
|
|
32
|
+
const header = ['<!--', ...meta.map((l) => ` ${l}`), '-->'].join('\n');
|
|
33
|
+
return `${header}\n\n${snippet.code}`;
|
|
34
|
+
}
|
|
35
|
+
case 'text': {
|
|
36
|
+
return snippet.code;
|
|
37
|
+
}
|
|
38
|
+
case 'php':
|
|
39
|
+
default: {
|
|
40
|
+
const header = ['<?php', '/**', ...meta.map((l) => ` * ${l}`), ' */'].join('\n');
|
|
41
|
+
const body = snippet.code.replace(/^<\?php\s*/i, '');
|
|
42
|
+
return `${header}\n\n${body}`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
5
46
|
export default class Pull extends LoopressCommand {
|
|
6
47
|
static args = {
|
|
7
48
|
path: Args.string({ description: 'Path to snippets directory (overrides project config)' }),
|
|
@@ -38,18 +79,29 @@ export default class Pull extends LoopressCommand {
|
|
|
38
79
|
const remoteList = await got.get(endpoint, { headers }).json();
|
|
39
80
|
const snippets = remoteList.map((r) => adapter.fromRemote(r));
|
|
40
81
|
const fs = await import('node:fs/promises');
|
|
82
|
+
await fs.mkdir(path, { recursive: true });
|
|
41
83
|
if (dryRun) {
|
|
42
84
|
this.log(`📝 [DRY RUN] Would pull ${snippets.length} snippets`);
|
|
85
|
+
this.log(`🔍 Raw API sample:\n${JSON.stringify(remoteList[0], null, 2)}`);
|
|
43
86
|
return;
|
|
44
87
|
}
|
|
45
88
|
let count = 0;
|
|
89
|
+
let skipped = 0;
|
|
46
90
|
for (const snippet of snippets) {
|
|
47
|
-
|
|
48
|
-
|
|
91
|
+
if (!snippet.name.trim()) {
|
|
92
|
+
skipped++;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const ext = EXTENSIONS[snippet.type];
|
|
96
|
+
const filePath = `${path}/${slugify(snippet.name, { lower: true, strict: true })}.${ext}`;
|
|
97
|
+
await fs.writeFile(filePath, buildSnippetFile(snippet));
|
|
49
98
|
count++;
|
|
50
99
|
this.log(`✅ Pulled: ${snippet.name}`);
|
|
51
100
|
}
|
|
52
101
|
this.log(`🎉 Successfully pulled ${count} snippet${count === 1 ? '' : 's'} to ${path}`);
|
|
102
|
+
if (skipped > 0) {
|
|
103
|
+
this.warn(`${skipped} snippet${skipped === 1 ? '' : 's'} skipped because they have no name`);
|
|
104
|
+
}
|
|
53
105
|
}
|
|
54
106
|
catch (error) {
|
|
55
107
|
this.error(`❌ Error pulling snippets: ${error.message}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import got from 'got';
|
|
3
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
3
4
|
import { getSnippetPlugin } from '../../utils/snippet-plugin.js';
|
|
4
|
-
import { LoopressCommand } from '../base.js';
|
|
5
5
|
export default class Push extends LoopressCommand {
|
|
6
6
|
static args = {
|
|
7
7
|
path: Args.string({ description: 'Path to snippets directory (overrides project config)' }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import got from 'got';
|
|
3
|
-
import { LoopressCommand } from '
|
|
3
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
4
4
|
export default class Pull extends LoopressCommand {
|
|
5
5
|
static description = 'Pull Global Styles from WordPress';
|
|
6
6
|
static examples = ['$ lps styles pull', '$ lps styles pull --url http://example.com'];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { glob } from 'glob';
|
|
3
3
|
import got from 'got';
|
|
4
|
-
import { LoopressCommand } from '
|
|
4
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
5
5
|
export default class Push extends LoopressCommand {
|
|
6
6
|
static description = 'Push Global Styles to WordPress';
|
|
7
7
|
static examples = ['$ lps styles push', '$ lps styles push --url http://example.com'];
|
package/dist/help.d.ts
ADDED
package/dist/help.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Help } from '@oclif/core';
|
|
2
|
+
const BANNER = `
|
|
3
|
+
|
|
4
|
+
@@@@@@@@@@@*
|
|
5
|
+
@@@@@@@@@@@*++
|
|
6
|
+
@@@@ ++++
|
|
7
|
+
@@@@ ++++ ▗▖ ▗▄▖ ▗▄▖ ▗▄▄▖ ▗▄▄▖ ▗▄▄▄▖ ▗▄▄▖ ▗▄▄▖
|
|
8
|
+
@@@@ ++++ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌ ▐▌
|
|
9
|
+
@@@@ ++++ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▛▀▘ ▐▛▀▚▖▐▛▀▀▘ ▝▀▚▖ ▝▀▚▖
|
|
10
|
+
@@@@ ++++ ▐▙▄▄▖▝▚▄▞▘▝▚▄▞▘▐▌ ▐▌ ▐▌▐▙▄▄▖▗▄▄▞▘▗▄▄▞▘
|
|
11
|
+
@@@@ ++++
|
|
12
|
+
@@@@ ++++
|
|
13
|
+
@@@@@@@@@@@*++
|
|
14
|
+
@@@@@@@@@@@*
|
|
15
|
+
|
|
16
|
+
`;
|
|
17
|
+
export default class CustomHelp extends Help {
|
|
18
|
+
async showRootHelp() {
|
|
19
|
+
this.log(BANNER);
|
|
20
|
+
await super.showRootHelp();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type PluginName = 'code-snippets' | 'wpcode';
|
|
2
|
+
export type SnippetType = 'css' | 'html' | 'js' | 'php' | 'text';
|
|
2
3
|
export interface NormalizedSnippet {
|
|
3
4
|
active: boolean;
|
|
4
5
|
code: string;
|
|
@@ -6,6 +7,7 @@ export interface NormalizedSnippet {
|
|
|
6
7
|
id: number;
|
|
7
8
|
name: string;
|
|
8
9
|
tags: string[];
|
|
10
|
+
type: SnippetType;
|
|
9
11
|
}
|
|
10
12
|
export interface SnippetPlugin {
|
|
11
13
|
endpoint(siteUrl: string): string;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
function parseType(raw) {
|
|
2
|
+
const valid = ['css', 'html', 'js', 'php', 'text'];
|
|
3
|
+
const value = String(raw ?? '').toLowerCase();
|
|
4
|
+
return valid.includes(value) ? value : null;
|
|
5
|
+
}
|
|
6
|
+
function inferTypeFromCode(code) {
|
|
7
|
+
const firstLine = code.trimStart().split('\n')[0].trimStart();
|
|
8
|
+
if (firstLine.startsWith('<?'))
|
|
9
|
+
return 'php';
|
|
10
|
+
if (firstLine.startsWith('<'))
|
|
11
|
+
return 'html';
|
|
12
|
+
return 'php';
|
|
13
|
+
}
|
|
14
|
+
function resolveType(raw, code) {
|
|
15
|
+
return parseType(raw) ?? inferTypeFromCode(code);
|
|
16
|
+
}
|
|
1
17
|
class CodeSnippetsPlugin {
|
|
2
18
|
endpoint(siteUrl) {
|
|
3
19
|
return `${siteUrl}/wp-json/code-snippets/v1/snippets`;
|
|
@@ -10,6 +26,7 @@ class CodeSnippetsPlugin {
|
|
|
10
26
|
id: Number(data.id),
|
|
11
27
|
name: String(data.name ?? ''),
|
|
12
28
|
tags: Array.isArray(data.tags) ? data.tags : [],
|
|
29
|
+
type: resolveType(data.type, String(data.code ?? '')),
|
|
13
30
|
};
|
|
14
31
|
}
|
|
15
32
|
toPayload(name, code, path) {
|
|
@@ -33,6 +50,7 @@ class WPCodePlugin {
|
|
|
33
50
|
id: Number(data.id),
|
|
34
51
|
name: String(data.title ?? ''),
|
|
35
52
|
tags: Array.isArray(data.tags) ? data.tags : [],
|
|
53
|
+
type: resolveType(data.type, String(data.code ?? '')),
|
|
36
54
|
};
|
|
37
55
|
}
|
|
38
56
|
toPayload(name, code, path) {
|
package/oclif.manifest.json
CHANGED
|
@@ -1,49 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
-
"base": {
|
|
4
|
-
"aliases": [],
|
|
5
|
-
"args": {},
|
|
6
|
-
"flags": {
|
|
7
|
-
"password": {
|
|
8
|
-
"description": "WordPress application password (fallback; prefer `lps project config`)",
|
|
9
|
-
"helpGroup": "GLOBAL",
|
|
10
|
-
"name": "password",
|
|
11
|
-
"hasDynamicHelp": false,
|
|
12
|
-
"multiple": false,
|
|
13
|
-
"type": "option"
|
|
14
|
-
},
|
|
15
|
-
"url": {
|
|
16
|
-
"description": "WordPress URL (fallback; prefer `lps project config`)",
|
|
17
|
-
"helpGroup": "GLOBAL",
|
|
18
|
-
"name": "url",
|
|
19
|
-
"hasDynamicHelp": false,
|
|
20
|
-
"multiple": false,
|
|
21
|
-
"type": "option"
|
|
22
|
-
},
|
|
23
|
-
"user": {
|
|
24
|
-
"description": "WordPress username (fallback; prefer `lps project config`)",
|
|
25
|
-
"helpGroup": "GLOBAL",
|
|
26
|
-
"name": "user",
|
|
27
|
-
"hasDynamicHelp": false,
|
|
28
|
-
"multiple": false,
|
|
29
|
-
"type": "option"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"hasDynamicHelp": false,
|
|
33
|
-
"hiddenAliases": [],
|
|
34
|
-
"id": "base",
|
|
35
|
-
"pluginAlias": "@loopress/cli",
|
|
36
|
-
"pluginName": "@loopress/cli",
|
|
37
|
-
"pluginType": "core",
|
|
38
|
-
"strict": true,
|
|
39
|
-
"enableJsonFlag": false,
|
|
40
|
-
"isESM": true,
|
|
41
|
-
"relativePath": [
|
|
42
|
-
"dist",
|
|
43
|
-
"commands",
|
|
44
|
-
"base.js"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
3
|
"login": {
|
|
48
4
|
"aliases": [],
|
|
49
5
|
"args": {},
|
|
@@ -574,5 +530,5 @@
|
|
|
574
530
|
]
|
|
575
531
|
}
|
|
576
532
|
},
|
|
577
|
-
"version": "0.
|
|
533
|
+
"version": "0.2.0"
|
|
578
534
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopress/cli",
|
|
3
3
|
"description": "CLI tool for syncing WordPress CodeSnippets, styles, and menus via the REST API",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"author": "jean-smaug",
|
|
6
6
|
"bin": {
|
|
7
7
|
"loopress": "bin/run.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"@oclif/plugin-help": "^6.2.50",
|
|
17
17
|
"@oclif/plugin-plugins": "^5.4.72",
|
|
18
18
|
"glob": "13.0.6",
|
|
19
|
-
"got": "^15.0.5"
|
|
19
|
+
"got": "^15.0.5",
|
|
20
|
+
"slugify": "^1.6.9"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@eslint/compat": "2.1.0",
|
|
@@ -53,12 +54,14 @@
|
|
|
53
54
|
"main": "dist/index.js",
|
|
54
55
|
"type": "module",
|
|
55
56
|
"oclif": {
|
|
57
|
+
"bin": "lps",
|
|
56
58
|
"binAliases": [
|
|
57
59
|
"loopress",
|
|
58
60
|
"lps"
|
|
59
61
|
],
|
|
60
62
|
"dirname": "loopress",
|
|
61
63
|
"commands": "./dist/commands",
|
|
64
|
+
"helpClass": "./dist/help.js",
|
|
62
65
|
"plugins": [
|
|
63
66
|
"@oclif/plugin-help",
|
|
64
67
|
"@oclif/plugin-plugins"
|
|
File without changes
|
|
File without changes
|