git-drive 0.1.2 → 0.1.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 (2) hide show
  1. package/dist/index.js +8 -0
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const child_process_1 = require("child_process");
5
+ const fs_1 = require("fs");
5
6
  const push_js_1 = require("./commands/push.js");
6
7
  const list_js_1 = require("./commands/list.js");
7
8
  const status_js_1 = require("./commands/status.js");
@@ -9,6 +10,7 @@ const link_js_1 = require("./commands/link.js");
9
10
  const init_js_1 = require("./commands/init.js");
10
11
  const errors_js_1 = require("./errors.js");
11
12
  const server_js_1 = require("./server.js");
13
+ const { version: VERSION } = JSON.parse((0, fs_1.readFileSync)(__dirname + '/../package.json', 'utf-8'));
12
14
  const commands = {
13
15
  init: init_js_1.init,
14
16
  push: push_js_1.push,
@@ -37,6 +39,7 @@ Commands:
37
39
  server, start, ui Start the git-drive web UI server
38
40
 
39
41
  Options:
42
+ -v, -V, --version Show version number
40
43
  -h, --help Show this help message
41
44
 
42
45
  Examples:
@@ -81,6 +84,11 @@ const [command, ...args] = process.argv.slice(2);
81
84
  printUsage();
82
85
  process.exit(0);
83
86
  }
87
+ // Handle version flags
88
+ if (command === "--version" || command === "-v" || command === "-V" || command === "version") {
89
+ console.log(`git-drive v${VERSION}`);
90
+ process.exit(0);
91
+ }
84
92
  const handler = commands[command];
85
93
  if (!handler) {
86
94
  console.error(`Unknown command: ${command}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-drive",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Turn any external drive into a git remote backup for your code - CLI, server, and web UI",
5
5
  "keywords": [
6
6
  "git",
@@ -24,7 +24,7 @@
24
24
  "homepage": "https://github.com/josmanvis/git-drive#readme",
25
25
  "type": "commonjs",
26
26
  "bin": {
27
- "git-drive": "./dist/index.js"
27
+ "git-drive": "dist/index.js"
28
28
  },
29
29
  "main": "./dist/index.js",
30
30
  "files": [
@@ -53,4 +53,4 @@
53
53
  "engines": {
54
54
  "node": ">=18"
55
55
  }
56
- }
56
+ }