mdbrowse-cli 0.1.1 → 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.
@@ -11,7 +11,7 @@ program
11
11
  .version('0.1.0')
12
12
  .argument('[directory]', 'Directory to serve', '.')
13
13
  .option('-p, --port <number>', 'Port to listen on', '3000')
14
- .option('--host <address>', 'Host to bind to', 'localhost')
14
+ .option('--host <address>', 'Host to bind to', '0.0.0.0')
15
15
  .option('--no-ignore', 'Show all files (ignore .gitignore)')
16
16
  .option('--auth <credentials>', 'Require basic auth (user:pass)')
17
17
  .option('--read-only', 'Disable file editing')
@@ -41,9 +41,22 @@ program
41
41
  readOnly,
42
42
  });
43
43
 
44
- const url = `http://${host === '0.0.0.0' ? 'localhost' : host}:${actualPort}`;
44
+ const localUrl = `http://localhost:${actualPort}`;
45
45
  console.log(`\n mdbrowse-cli serving ${directory}`);
46
- console.log(` → ${url}\n`);
46
+ console.log(` → Local: ${localUrl}`);
47
+
48
+ if (host === '0.0.0.0') {
49
+ const { networkInterfaces } = await import('os');
50
+ const nets = networkInterfaces();
51
+ for (const name of Object.keys(nets)) {
52
+ for (const net of nets[name]) {
53
+ if (net.family === 'IPv4' && !net.internal) {
54
+ console.log(` → Network: http://${net.address}:${actualPort}`);
55
+ }
56
+ }
57
+ }
58
+ }
59
+ console.log();
47
60
 
48
61
  if (options.tunnel) {
49
62
  const { startTunnel, registerCleanup } = await import('../src/tunnel.js');
@@ -73,7 +86,7 @@ program
73
86
  : process.platform === 'win32'
74
87
  ? 'start'
75
88
  : 'xdg-open';
76
- exec(`${cmd} ${url}`);
89
+ exec(`${cmd} ${localUrl}`);
77
90
  }
78
91
  });
79
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdbrowse-cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "CLI tool to browse and preview markdown files in any directory",
5
5
  "type": "module",
6
6
  "bin": {