UNPKG

l7note

Version:

Access your notion notes quick

59 lines (58 loc) 2.81 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.displayConfig = void 0; const chalk_1 = __importDefault(require("chalk")); const getSettingValueByName_js_1 = require("../helper/getSettingValueByName.js"); const getDatabaseInfo_js_1 = require("../noteActions/getDatabaseInfo.js"); const setup_js_1 = require("../setup.js"); const displayConfig = () => __awaiter(void 0, void 0, void 0, function* () { const dbInfo = yield (0, getDatabaseInfo_js_1.getDatabseInfo)(setup_js_1.globalConfig.dbId); const dbTitle = dbInfo.title[0].plain_text; const dbUrl = dbInfo.url; if (setup_js_1.globalConfig.optionalArgs.length == 0) { console.log(chalk_1.default.green('add p\tPath to config file')); console.log(chalk_1.default.green(`add t\tToken of integration ${chalk_1.default.red('!sensetive!')}`)); console.log(chalk_1.default.green('add d\tSelected databse')); console.log(chalk_1.default.green(`add a\tDisplay the complete config ${chalk_1.default.red('!sensetive!')}`)); return; } const selectedField = (0, getSettingValueByName_js_1.getSettingValueByName)('-h'); switch (selectedField) { case 'p': case 'config': case 'path': console.log(chalk_1.default.green(setup_js_1.globalConfig.configPath)); break; case 't': case 'token': case 'secret': console.log(chalk_1.default.green(setup_js_1.globalConfig.token)); break; case 'd': case 'db': case 'selected': case 'currentDb': case 'database': console.log(chalk_1.default.green(dbTitle)); console.log(chalk_1.default.green(dbUrl)); break; case 'a': case 'all': console.table(setup_js_1.globalConfig); default: break; } }); exports.displayConfig = displayConfig;