thinkncollab-cli 0.0.36 → 0.0.38
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 +1 -1
- package/bin/index.js +10 -0
- package/commands/help.js +16 -0
- package/commands/version.js +0 -0
- package/commands/whoami.js +19 -0
- package/package.json +1 -1
package/Readme.md
CHANGED
package/bin/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import FormData from "form-data";
|
|
|
9
9
|
import projectInit from "../commands/init.js";
|
|
10
10
|
import Status from "../commands/status.js";
|
|
11
11
|
import pull from "../commands/pull.js";
|
|
12
|
+
import whoami from "../commands/whoami.js";
|
|
13
|
+
import help from "../commands/help.js";
|
|
12
14
|
|
|
13
15
|
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
14
16
|
const VERSION_FILE = path.join(process.cwd(), ".tncversions");
|
|
@@ -464,6 +466,14 @@ async function main() {
|
|
|
464
466
|
await pull(roomId, version);
|
|
465
467
|
break;
|
|
466
468
|
}
|
|
469
|
+
|
|
470
|
+
case "whoami":
|
|
471
|
+
await whoami();
|
|
472
|
+
break;
|
|
473
|
+
|
|
474
|
+
case "help":
|
|
475
|
+
await help();
|
|
476
|
+
break;
|
|
467
477
|
|
|
468
478
|
default:
|
|
469
479
|
console.log("✅ TNC CLI ready!");
|
package/commands/help.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
async function help() {
|
|
4
|
+
console.log(chalk.red(" Command | Description "));
|
|
5
|
+
console.log(chalk.green(" `tnc-cli login` ")| chalk.yellow("Authenticate with ThinkNCollab"));
|
|
6
|
+
console.log(chalk.green("`tnc-cli logout` ")| chalk.yellow("Clear credentials "))
|
|
7
|
+
console.log(chalk.green("`tnc-cli whoami` ")| chalk.yellow("Show current user info"))
|
|
8
|
+
console.log(chalk.green("`tnc-cli push --room <id> <path>` ")| chalk.yellow("Push files/folders to a room"))
|
|
9
|
+
console.log(chalk.green("`tnc-cli rooms list`") | chalk.yellow("List all accessible rooms"))
|
|
10
|
+
console.log(chalk.green("`tnc-cli rooms info <id>` ")| chalk.yellow("Show room details"))
|
|
11
|
+
console.log(chalk.green("`tnc-cli --help` ")| chalk.yellow("Show help information "))
|
|
12
|
+
console.log(chalk.green(" `tnc-cli --version` ")| chalk.yellow("Show CLI version"))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
export default help;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
6
|
+
|
|
7
|
+
async function whoami() {
|
|
8
|
+
try{
|
|
9
|
+
if(fs.existsSync(RC_FILE)) {
|
|
10
|
+
const rcData = fs.readFileSync(RC_FILE, "utf-8");
|
|
11
|
+
const {email} = JSON.parse(rcData);
|
|
12
|
+
console.log('You are logged in by the email:', email);
|
|
13
|
+
}
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error reading .tncrc file:', error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default whoami;
|