thinkncollab-cli 0.0.49 → 0.0.51
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/myTask.js +24 -0
- package/commands/whoami.js +4 -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,6 +501,10 @@ async function main() {
|
|
|
499
501
|
case "version":
|
|
500
502
|
await version();
|
|
501
503
|
break;
|
|
504
|
+
|
|
505
|
+
case "my-tasks":
|
|
506
|
+
await MyTasks();
|
|
507
|
+
break;
|
|
502
508
|
|
|
503
509
|
default:
|
|
504
510
|
console.log("✅ TNC CLI ready!");
|
|
@@ -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
|
+
}
|
package/commands/whoami.js
CHANGED
|
@@ -11,6 +11,10 @@ const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
|
11
11
|
const {email} = JSON.parse(rcData);
|
|
12
12
|
console.log('You are logged in by the email:', email);
|
|
13
13
|
}
|
|
14
|
+
else{
|
|
15
|
+
console.log("You are not logged-in");
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
} catch (error) {
|
|
15
19
|
console.error('Error reading .tncrc file:', error);
|
|
16
20
|
}
|