thinkncollab-cli 0.0.39 → 0.0.41
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/bin/index.js +6 -0
- package/commands/version.js +20 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -11,6 +11,8 @@ import Status from "../commands/status.js";
|
|
|
11
11
|
import pull from "../commands/pull.js";
|
|
12
12
|
import whoami from "../commands/whoami.js";
|
|
13
13
|
import help from "../commands/help.js";
|
|
14
|
+
import version from "../commands/version.js";
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
16
18
|
const VERSION_FILE = path.join(process.cwd(), ".tncversions");
|
|
@@ -473,6 +475,10 @@ async function main() {
|
|
|
473
475
|
|
|
474
476
|
case "help":
|
|
475
477
|
await help();
|
|
478
|
+
break;
|
|
479
|
+
|
|
480
|
+
case "version":
|
|
481
|
+
await version();
|
|
476
482
|
break;
|
|
477
483
|
|
|
478
484
|
default:
|
package/commands/version.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import inquirer from "inquirer";
|
|
5
|
+
import axios from "axios";
|
|
6
|
+
|
|
7
|
+
const homeDir = os.homedir();
|
|
8
|
+
const pkg = path.join(homeDir, "AppData\Roaming\npm\thinkncollab-cli\package.json");
|
|
9
|
+
|
|
10
|
+
async function version() {
|
|
11
|
+
if(fs.existsSync(pkg)) {
|
|
12
|
+
const version = JSON.parse(fs.readFileSync(pkg, "utf-8")).version;
|
|
13
|
+
console.log(`ThinkNCollab CLI Version: ${version}`);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
console.log("ThinkNCollab CLI Version: Unknown");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default version;
|
|
20
|
+
|