my_wins 1.3.2 → 1.3.4

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/lib/index.js CHANGED
@@ -45,6 +45,7 @@ function awaitDelay(delay) {
45
45
  function parseArgs(argv) {
46
46
  const raw = argv.slice(2);
47
47
  let menu = false;
48
+ let version = false;
48
49
  let runName;
49
50
  const positional = [];
50
51
  for (let i = 0; i < raw.length; i++) {
@@ -62,10 +63,15 @@ function parseArgs(argv) {
62
63
  runName = arg.slice("--run=".length);
63
64
  continue;
64
65
  }
66
+ if (arg === "-v" || arg === "--version") {
67
+ version = true;
68
+ continue;
69
+ }
65
70
  positional.push(arg);
66
71
  }
67
72
  return {
68
73
  menu,
74
+ version,
69
75
  single: runName || positional[0],
70
76
  };
71
77
  }
@@ -239,11 +245,16 @@ async function runOnce(baseSettings, filterNames) {
239
245
  async function promptMenu(winNames) {
240
246
  const choices = winNames.map((name)=>({ name, value: name }));
241
247
  choices.push({ name: "exit", value: "__exit__", checked: true });
242
- const { selections } = await inquirer.prompt([
248
+ const prompt = inquirer.prompt || (inquirer.default && inquirer.default.prompt);
249
+ if (!prompt) {
250
+ throw new Error("Inquirer prompt API is unavailable. Please use a compatible inquirer version.");
251
+ }
252
+ const { selections } = await prompt([
243
253
  {
244
254
  type: "checkbox",
245
255
  name: "selections",
246
256
  message: "Select commands to run",
257
+ pageSize: Math.min(choices.length, 21),
247
258
  choices,
248
259
  },
249
260
  ]);
@@ -252,12 +263,18 @@ async function promptMenu(winNames) {
252
263
 
253
264
  module.exports.defaultSettings = defaultSettings;
254
265
  module.exports.run = async ()=>{
255
- console.log("Screen size:", keysender.getScreenSize());
266
+ const args = parseArgs(process.argv);
267
+ if (args.version) {
268
+ const pkgPath = require("path").join(__dirname, "..", "package.json");
269
+ const pkg = JSON.parse(fs.readFileSync(pkgPath));
270
+ console.log(pkg.version || "0.0.0");
271
+ process.exit(0);
272
+ }
256
273
 
257
274
  const settings = loadSettings();
258
275
  if (!settings) return;
259
276
 
260
- const args = parseArgs(process.argv);
277
+ console.log("Screen size:", keysender.getScreenSize());
261
278
  const winNames = Object.keys(settings.wins || {});
262
279
 
263
280
  if (args.menu) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my_wins",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Automates starting and laying out your console windows for tsc, babel, tests, verdaccio, etc...",
5
5
  "keywords": [
6
6
  "automation",
package/readme.md CHANGED
@@ -87,6 +87,14 @@ Run a single win by name:
87
87
  my_wins --run cmd1
88
88
  ```
89
89
 
90
+ ### Version
91
+
92
+ Print current version:
93
+
94
+ ```shell
95
+ my_wins --version
96
+ ```
97
+
90
98
  ### All options
91
99
 
92
100
  You can also create "my_wins_personal.json" which can partially or fully overrides my_wins.