@kud/cli-shot 0.2.0 → 0.2.1
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 +10 -5
- package/dist/{chunk-NTFITNMX.js → chunk-TKCXCDP2.js} +11 -12
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,11 +42,16 @@ cli-shot --out assets/screenshots -- pcloud
|
|
|
42
42
|
Everything after `--` is the command being driven, so its own flags stay clear
|
|
43
43
|
of cli-shot's.
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
cli-shot adds `--mock` and `--screen` to that command, but only where you
|
|
46
|
+
haven't. Anything you pass wins:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
cli-shot --out shots -- pcloud --screen sync # shoots Sync, writes sync.png
|
|
50
|
+
cli-shot --out shots --only sync -- pcloud # the same thing, said from here
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Naming a screen yourself is already an answer to "which one", so cli-shot skips
|
|
54
|
+
the discovery loop and takes the filename from your value.
|
|
50
55
|
|
|
51
56
|
```sh
|
|
52
57
|
cli-shot --out shots --only sync -- pcloud # one screen
|
|
@@ -161,18 +161,16 @@ var toImage = (ansi, output, { font = DEFAULT_FONT, freezeArgs = [] } = {}) => {
|
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
// src/index.ts
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (!clash) return;
|
|
168
|
-
throw new Error(
|
|
169
|
-
`${clash} is set by cli-shot, so passing it to the driven command leaves two in argv.
|
|
170
|
-
` + (clash === "--screen" ? ` Use cli-shot's --only <screen> instead, before the --.` : ` Mock data is on by default; use cli-shot's --no-mock to turn it off.`)
|
|
171
|
-
);
|
|
164
|
+
var drivenScreen = (args) => {
|
|
165
|
+
const at = args.indexOf("--screen");
|
|
166
|
+
return at === -1 ? void 0 : args[at + 1];
|
|
172
167
|
};
|
|
173
|
-
var screenArgs = (args, screen, mock) => [
|
|
168
|
+
var screenArgs = (args, screen, mock) => [
|
|
169
|
+
...args,
|
|
170
|
+
...mock && !args.includes("--mock") ? ["--mock"] : [],
|
|
171
|
+
...drivenScreen(args) === void 0 ? ["--screen", screen] : []
|
|
172
|
+
];
|
|
174
173
|
var shootScreen = async (screen, { command, args = [], out, mock = true, ...rest }) => {
|
|
175
|
-
assertNoManagedFlags(args);
|
|
176
174
|
const ansi = await capture(command, screenArgs(args, screen, mock), rest);
|
|
177
175
|
return toImage(ansi, join(out, `${screen}.png`), rest);
|
|
178
176
|
};
|
|
@@ -191,7 +189,8 @@ var pool = async (items, limit, run) => {
|
|
|
191
189
|
return results;
|
|
192
190
|
};
|
|
193
191
|
var shootAll = async (options) => {
|
|
194
|
-
|
|
192
|
+
const pinned = drivenScreen(options.args ?? []);
|
|
193
|
+
if (pinned) return [await shootScreen(pinned, options)];
|
|
195
194
|
const screens = listScreens(options.command, options.args ?? []);
|
|
196
195
|
return pool(
|
|
197
196
|
screens,
|
|
@@ -200,4 +199,4 @@ var shootAll = async (options) => {
|
|
|
200
199
|
);
|
|
201
200
|
};
|
|
202
201
|
|
|
203
|
-
export { DEFAULT_FONT,
|
|
202
|
+
export { DEFAULT_FONT, capture, drivenScreen, listScreens, shootAll, shootScreen, toImage };
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { DEFAULT_FONT, listScreens, shootScreen, shootAll } from './chunk-
|
|
2
|
+
import { DEFAULT_FONT, listScreens, shootScreen, shootAll } from './chunk-TKCXCDP2.js';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
|
|
5
5
|
var separator = process.argv.indexOf("--");
|
package/dist/index.d.ts
CHANGED
|
@@ -38,8 +38,8 @@ type ShootOptions = CaptureOptions & RenderOptions & {
|
|
|
38
38
|
/** How many screens to shoot at once. Defaults to the core count. */
|
|
39
39
|
concurrency?: number;
|
|
40
40
|
};
|
|
41
|
-
declare const
|
|
41
|
+
declare const drivenScreen: (args: readonly string[]) => string | undefined;
|
|
42
42
|
declare const shootScreen: (screen: string, { command, args, out, mock, ...rest }: ShootOptions) => Promise<string>;
|
|
43
43
|
declare const shootAll: (options: ShootOptions) => Promise<string[]>;
|
|
44
44
|
|
|
45
|
-
export { type CaptureOptions, DEFAULT_FONT,
|
|
45
|
+
export { type CaptureOptions, DEFAULT_FONT, type RenderOptions, type ShootOptions, capture, drivenScreen, listScreens, shootAll, shootScreen, toImage };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DEFAULT_FONT,
|
|
1
|
+
export { DEFAULT_FONT, capture, drivenScreen, listScreens, shootAll, shootScreen, toImage } from './chunk-TKCXCDP2.js';
|