@itd2902/auggw 1.0.2 → 1.0.6
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/SETUP.md +17 -1
- package/package.json +1 -1
- package/src/commands/status.js +12 -3
package/SETUP.md
CHANGED
|
@@ -7,7 +7,23 @@
|
|
|
7
7
|
## Cài đặt
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install -g auggw
|
|
10
|
+
npm install -g @itd2902/auggw
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Chạy từ source (local dev)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd cli
|
|
17
|
+
npm link
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Sau đó dùng `auggw` như bình thường. Mọi thay đổi trong source sẽ có hiệu lực ngay.
|
|
21
|
+
|
|
22
|
+
Gỡ link khi không cần:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd cli
|
|
26
|
+
npm unlink -g
|
|
11
27
|
```
|
|
12
28
|
|
|
13
29
|
## Đăng nhập
|
package/package.json
CHANGED
package/src/commands/status.js
CHANGED
|
@@ -13,17 +13,26 @@ async function statusCommand() {
|
|
|
13
13
|
} else {
|
|
14
14
|
console.log("📋 Current Account");
|
|
15
15
|
console.log(` Name: ${data.current.name}`);
|
|
16
|
-
console.log(` Tenant: ${data.current.tenantURL}`);
|
|
17
16
|
console.log(` Token: ...${data.current.accessToken}`);
|
|
18
17
|
console.log(
|
|
19
18
|
` Status: ${data.current.isLimited ? "🔴 Limited" : "🟢 Active"}`,
|
|
20
19
|
);
|
|
21
20
|
if (data.current.creditTotal) {
|
|
22
|
-
const
|
|
21
|
+
const remaining = data.current.creditRemaining || 0;
|
|
23
22
|
const total = data.current.creditTotal;
|
|
23
|
+
const used = total - remaining;
|
|
24
24
|
const pct = Math.round((used / total) * 100);
|
|
25
|
+
const barWidth = 30;
|
|
26
|
+
const filled = Math.round((pct / 100) * barWidth);
|
|
27
|
+
const empty = barWidth - filled;
|
|
28
|
+
const color = pct > 90 ? "\x1b[31m" : pct > 70 ? "\x1b[33m" : "\x1b[32m";
|
|
29
|
+
const reset = "\x1b[0m";
|
|
30
|
+
const bar = `${color}${"█".repeat(filled)}${"\x1b[90m"}${"░".repeat(empty)}${reset}`;
|
|
25
31
|
console.log(
|
|
26
|
-
` Credit: ${
|
|
32
|
+
` Credit: ${remaining.toLocaleString()} / ${total.toLocaleString()} remaining`,
|
|
33
|
+
);
|
|
34
|
+
console.log(
|
|
35
|
+
` ${bar} ${color}${pct}% used${reset}`,
|
|
27
36
|
);
|
|
28
37
|
}
|
|
29
38
|
console.log();
|