portly-cli 1.0.1 → 1.0.2
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 +6 -33
- package/package.json +1 -1
- package/src/index.js +6 -2
- package/src/ui/mainScreen.js +16 -10
- package/debug.log +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# 🔍 portly
|
|
1
|
+
# 🔍 portly
|
|
2
2
|
|
|
3
|
-
> A
|
|
3
|
+
> A CLI tool to explore and manage open ports. Like `lsof`, but with style.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|

|
|
@@ -17,17 +17,6 @@ npm install -g portly-cli
|
|
|
17
17
|
portly
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Or run locally:
|
|
21
|
-
```bash
|
|
22
|
-
# Navigate to the portly directory
|
|
23
|
-
cd portly
|
|
24
|
-
|
|
25
|
-
# Run the app
|
|
26
|
-
node src/index.js
|
|
27
|
-
# or
|
|
28
|
-
npm start
|
|
29
|
-
```
|
|
30
|
-
|
|
31
20
|
---
|
|
32
21
|
|
|
33
22
|
## ⌨️ Keyboard Shortcuts
|
|
@@ -131,13 +120,13 @@ When you press `K` on a port, a confirmation dialog appears:
|
|
|
131
120
|
+----------------------------------+
|
|
132
121
|
| |
|
|
133
122
|
| Process: ControlCe |
|
|
134
|
-
| PID: 602
|
|
123
|
+
| PID: 602 |
|
|
135
124
|
| Port: 5000 |
|
|
136
125
|
| |
|
|
137
126
|
| Are you sure you want to kill |
|
|
138
127
|
| this process? |
|
|
139
128
|
| |
|
|
140
|
-
|
|
|
129
|
+
| [Y] KILL [N]/[ESC] CANCEL |
|
|
141
130
|
| |
|
|
142
131
|
+----------------------------------+
|
|
143
132
|
```
|
|
@@ -157,6 +146,7 @@ When auto-refresh is enabled (`[AUTO-ON]`), portly automatically scans every 2 s
|
|
|
157
146
|
- macOS or Linux
|
|
158
147
|
- Node.js 16 or higher
|
|
159
148
|
- `lsof` command (standard on macOS/Linux)
|
|
149
|
+
- Linux only: `xclip` or `xsel` for copy-to-clipboard feature
|
|
160
150
|
|
|
161
151
|
---
|
|
162
152
|
|
|
@@ -166,27 +156,10 @@ When auto-refresh is enabled (`[AUTO-ON]`), portly automatically scans every 2 s
|
|
|
166
156
|
# Install globally via npm
|
|
167
157
|
npm install -g portly-cli
|
|
168
158
|
|
|
169
|
-
# Run
|
|
159
|
+
# Run the app
|
|
170
160
|
portly
|
|
171
161
|
```
|
|
172
162
|
|
|
173
|
-
### For Development
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
# Clone the repo
|
|
177
|
-
git clone <your-repo-url>
|
|
178
|
-
cd portly
|
|
179
|
-
|
|
180
|
-
# Install dependencies
|
|
181
|
-
npm install
|
|
182
|
-
|
|
183
|
-
# Run
|
|
184
|
-
npm start
|
|
185
|
-
|
|
186
|
-
# Or with file watching (auto-reload on changes)
|
|
187
|
-
npm run dev
|
|
188
|
-
```
|
|
189
|
-
|
|
190
163
|
---
|
|
191
164
|
|
|
192
165
|
## 🎨 Port States
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -4,6 +4,9 @@ const blessed = require('blessed');
|
|
|
4
4
|
const MainScreen = require('./ui/mainScreen');
|
|
5
5
|
const { scanPorts } = require('./utils/portScanner');
|
|
6
6
|
|
|
7
|
+
// Disable warnings on startup
|
|
8
|
+
process.emit('warning', { name: 'DeprecationWarning', code: 'DEP', suppress: true });
|
|
9
|
+
|
|
7
10
|
class Portly {
|
|
8
11
|
constructor() {
|
|
9
12
|
this.screen = null;
|
|
@@ -13,11 +16,12 @@ class Portly {
|
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
init() {
|
|
16
|
-
// Create the screen
|
|
19
|
+
// Create the screen with fallback terminal
|
|
17
20
|
this.screen = blessed.screen({
|
|
18
21
|
smartCSR: true,
|
|
19
22
|
title: 'portly - port explorer',
|
|
20
|
-
warnings:
|
|
23
|
+
warnings: false,
|
|
24
|
+
terminal: process.env.TERM || 'xterm',
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
// Create main screen (binds keys internally)
|
package/src/ui/mainScreen.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
const blessed = require('blessed');
|
|
2
2
|
const { CATEGORY_LABELS } = require('../utils/portScanner');
|
|
3
3
|
|
|
4
|
+
// Cross-platform clipboard copy
|
|
5
|
+
function copyToClipboard(text) {
|
|
6
|
+
const exec = require('child_process').exec;
|
|
7
|
+
const isMac = process.platform === 'darwin';
|
|
8
|
+
const cmd = isMac
|
|
9
|
+
? `echo "${text}" | pbcopy`
|
|
10
|
+
: `echo "${text}" | xclip -selection clipboard 2>/dev/null || echo "${text}" | xsel --clipboard 2>/dev/null || echo "Clipboard not available (install xclip)"`;
|
|
11
|
+
exec(cmd, () => {});
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
const STATUS_ICONS = {
|
|
5
15
|
LISTEN: '[L]',
|
|
6
16
|
ESTABLISHED: '[E]',
|
|
@@ -511,21 +521,17 @@ class MainScreen {
|
|
|
511
521
|
}
|
|
512
522
|
|
|
513
523
|
copyPort() {
|
|
514
|
-
const exec = require('child_process').exec;
|
|
515
524
|
const port = this.selectedPort.port;
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
});
|
|
525
|
+
copyToClipboard(port);
|
|
526
|
+
this.statusBar.setContent(`Copied port ${port} to clipboard!`);
|
|
527
|
+
this.renderStatusBar();
|
|
520
528
|
}
|
|
521
529
|
|
|
522
530
|
copyPid() {
|
|
523
|
-
const exec = require('child_process').exec;
|
|
524
531
|
const pid = this.selectedPort.pid;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
});
|
|
532
|
+
copyToClipboard(pid);
|
|
533
|
+
this.statusBar.setContent(`Copied PID ${pid} to clipboard!`);
|
|
534
|
+
this.renderStatusBar();
|
|
529
535
|
}
|
|
530
536
|
}
|
|
531
537
|
|
package/debug.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This file is just a marker.
|