@indah_sekar/os-t 1.0.1 → 1.0.3

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/README.md +1 -0
  2. package/bin/cli.js +13 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -74,3 +74,4 @@ import commands from "@indah-sekar/os-t";
74
74
  - **Export History** — Download terminal history as a text file
75
75
  - **Difficulty Indicators** — See at a glance whether a command is easy, medium, or hard
76
76
  - **CLI Tool** — Use from the command line after `npm install -g`
77
+ "# os-t"
package/bin/cli.js CHANGED
@@ -57,7 +57,7 @@ function listCommands(osFilter, categoryFilter, searchQuery) {
57
57
  continue;
58
58
  }
59
59
  const categories = commands[os];
60
- let osHeaderPrinted = false;
60
+ let allCmds = [];
61
61
  for (const cat of categories) {
62
62
  if (
63
63
  categoryFilter &&
@@ -75,15 +75,15 @@ function listCommands(osFilter, categoryFilter, searchQuery) {
75
75
  c.command.toLowerCase().includes(q),
76
76
  );
77
77
  }
78
- if (cmds.length === 0) continue;
79
- if (!osHeaderPrinted) {
80
- console.log(`\n ${os}`);
81
- osHeaderPrinted = true;
82
- }
83
- for (const cmd of cmds) {
84
- console.log(` ${cmd.command.padEnd(40)}${cmd.description}`);
85
- total++;
86
- }
78
+ allCmds.push(...cmds);
79
+ }
80
+ if (allCmds.length === 0) continue;
81
+ const maxNameLen = Math.max(...allCmds.map((c) => c.name.length), 4);
82
+ console.log(`\n ${os}`);
83
+ console.log(` ${"name".padEnd(maxNameLen)} description`);
84
+ for (const cmd of allCmds) {
85
+ console.log(` ${cmd.name.padEnd(maxNameLen)} ${cmd.description}`);
86
+ total++;
87
87
  }
88
88
  }
89
89
  console.log(`\n Total: ${total} command(s)`);
@@ -142,13 +142,14 @@ function prepareCommand(cmd, os) {
142
142
 
143
143
  function printResults(results) {
144
144
  let currentOs = null;
145
+ const maxNameLen = Math.max(...results.map((r) => r.name.length), 4);
145
146
  for (const r of results) {
146
- const finalCmd = prepareCommand(r.command, r.os);
147
147
  if (r.os !== currentOs) {
148
148
  console.log(`\n ${r.os}`);
149
+ console.log(` ${"name".padEnd(maxNameLen)} description`);
149
150
  currentOs = r.os;
150
151
  }
151
- console.log(` ${finalCmd.padEnd(40)}${r.description}`);
152
+ console.log(` ${r.name.padEnd(maxNameLen)} ${r.description}`);
152
153
  }
153
154
  console.log(`\n Found: ${results.length} command(s)`);
154
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indah_sekar/os-t",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Quick troubleshooting commands for Windows, Linux & macOS. CLI tool + web app.",
5
5
  "keywords": [
6
6
  "troubleshooting",