torrent-tui 0.0.1 → 0.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 +3 -1
- package/package.json +1 -1
- package/src/constants/index.ts +0 -1
- package/src/index.ts +10 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# torrent-tui
|
|
2
2
|
|
|
3
|
-
**A
|
|
3
|
+
**A terminal BitTorrent client for focused download management.** Add `.torrent` files, track active transfers, and manage sessions from a clean keyboard-driven interface.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/torrent-tui)
|
|
6
6
|
[](https://github.com/ryadios/torrent-tui/actions/workflows/ci.yml)
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
[Install](#install) · [Quickstart](#quickstart) · [Commands](#commands) · [Configuration](#configuration) · [Development](#development)
|
|
10
10
|
|
|
11
|
+

|
|
12
|
+
|
|
11
13
|
> [!NOTE]
|
|
12
14
|
> `torrent-tui` currently requires [Bun](https://bun.sh). Standalone binaries are planned after the npm CLI release path is stable.
|
|
13
15
|
|
package/package.json
CHANGED
package/src/constants/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { VERSION } from "./constants";
|
|
4
3
|
import { getPeers } from "./torrent/get_peers";
|
|
5
4
|
|
|
6
5
|
class CliExit extends Error {}
|
|
7
6
|
|
|
7
|
+
async function getVersion(): Promise<string> {
|
|
8
|
+
const pkg = await import("../package.json");
|
|
9
|
+
return pkg.default.version as string;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
function fail(msg: string): never {
|
|
9
13
|
console.error(msg);
|
|
10
14
|
process.exitCode = 1;
|
|
11
15
|
throw new CliExit();
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function printHelp(): void {
|
|
15
|
-
|
|
18
|
+
async function printHelp(): Promise<void> {
|
|
19
|
+
const version = await getVersion();
|
|
20
|
+
console.log(`torrent-tui ${version}
|
|
16
21
|
|
|
17
22
|
Usage:
|
|
18
23
|
torrent-tui Start the terminal UI
|
|
@@ -261,12 +266,12 @@ async function main() {
|
|
|
261
266
|
const args = process.argv.slice(2);
|
|
262
267
|
|
|
263
268
|
if (args.includes("--help") || args.includes("-h")) {
|
|
264
|
-
printHelp();
|
|
269
|
+
await printHelp();
|
|
265
270
|
return;
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
if (args.includes("--version") || args.includes("-v")) {
|
|
269
|
-
console.log(
|
|
274
|
+
console.log(await getVersion());
|
|
270
275
|
return;
|
|
271
276
|
}
|
|
272
277
|
|