thinkncollab-cli 0.0.50 → 0.0.52
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 +12 -1
- package/commands/myTask.js +24 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -13,6 +13,8 @@ import whoami from "../commands/whoami.js";
|
|
|
13
13
|
import help from "../commands/help.js";
|
|
14
14
|
import version from "../commands/version.js";
|
|
15
15
|
import createBranch from "../commands/branch.js"
|
|
16
|
+
import MyTasks from "../commands/myTask.js"
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
@@ -499,7 +501,16 @@ async function main() {
|
|
|
499
501
|
case "version":
|
|
500
502
|
await version();
|
|
501
503
|
break;
|
|
502
|
-
|
|
504
|
+
|
|
505
|
+
case "my-tasks":{
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
const roomIdx = args.indexOf("my-tasks");
|
|
509
|
+
const roomId = agrs[roomIdx+1];
|
|
510
|
+
|
|
511
|
+
await MyTasks(roomId);
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
503
514
|
default:
|
|
504
515
|
console.log("✅ TNC CLI ready!");
|
|
505
516
|
console.log("Commands:");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from "fs"
|
|
2
|
+
import axios from "axios"
|
|
3
|
+
import os from "os"
|
|
4
|
+
const homeDir = os.homedir();
|
|
5
|
+
const url = "http://localhost:3001/cli/mytasks";
|
|
6
|
+
|
|
7
|
+
async function getEmail() {
|
|
8
|
+
const rcFile = path.join(homeDir, '.tncrc');
|
|
9
|
+
if(!rcFile) {
|
|
10
|
+
console.log("Please Login")
|
|
11
|
+
}
|
|
12
|
+
const content = fs.readFileSync(rcFile);
|
|
13
|
+
const email = JSON.parse(content).email;
|
|
14
|
+
return email;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function myTask(roomId) {
|
|
18
|
+
const email = getEmai();
|
|
19
|
+
const res = await axios.post(`${url}/${roomId}`,{
|
|
20
|
+
" email": email
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
console.log(res);
|
|
24
|
+
}
|