@jpillora/take 0.9.0 → 0.9.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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/take.d.mts +1 -0
  3. package/take.mjs +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpillora/take",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "A minimal CLI library for building TypeScript-based command-line tools",
5
5
  "type": "module",
6
6
  "main": "./take.mjs",
package/take.d.mts CHANGED
@@ -34,6 +34,7 @@ export type SpawnOptions = {
34
34
  args?: string[];
35
35
  } & nodeSpawnOptions;
36
36
  export declare function spawn(options: SpawnOptions): Promise<number>;
37
+ export declare const $: (script: string) => Promise<void>;
37
38
  export declare const timer: () => () => string;
38
39
  export declare function Register(...commands: NewCommand<any>[]): Promise<void>;
39
40
  export declare function Command<F extends Flags>(command: TakeCommand<F>): NewCommand<F>;
package/take.mjs CHANGED
@@ -51,6 +51,14 @@ export async function spawn(options) {
51
51
  });
52
52
  });
53
53
  }
54
+ // helper for running bash scripts
55
+ export const $ = async (script) => {
56
+ await spawn({
57
+ program: "bash",
58
+ args: ["-c", script],
59
+ stdio: "inherit",
60
+ });
61
+ };
54
62
  // helper for measuring time
55
63
  export const timer = (() => {
56
64
  const scale = [