Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
// Delete all saved URLs
db.unset('urls').write();
console.log(chalk.green('Successfully deleted all saved URLs!'));
} catch (error) {
console.log(chalk.red('Error deleting saved URLs! Are you sure there are any?'));
process.exit(1);
}
} else {
process.exit(1);
}
})();
}
if (cli.flags.reset) {
firstRun.clear();
config.clear();
console.log(chalk.green('Token deleted! Type `bitly` to configure a new one :)'));
}
export default async (
{ size, directory, auth, folders } = {},
{ restore } = {}
) => {
clear();
if (restore) {
frun.clear();
printBlock(chalk`{green Settings restored.}`);
quit();
}
const questions = [];
const choices = ["raw", "full", "regular", "thumb"];
// TODO: Add user authentication.
// const authQuestion = {
// name: "_auth",
// message: "Access Token",
// default: config.get("auth-key"),
// validate: token => {
// const regex = /[a-z0-9]/g;
// return regex.test(token) ? true : "Invalid token";
.then(async ({ confirm }) => {
if (confirm) {
frun.clear();
await clearSettings();
printBlock(chalk`{yellow Settings Restored!}`);
} else {
printBlock(chalk`{red {bold Operation aborted!}}`);
}
})
.catch((error) => {
.then(({ confirm }: any) => {
if (confirm) {
frun.clear();
clearSettings().then(() => {
printBlock(chalk`{yellow Settings Restored!}`);
});
} else {
printBlock(chalk`{red {bold Operation aborted!}}`);
}
})
.catch((error: any) => {
function init () {
if (firstRun()) {
insight.track('install')
}
if (firstRun({name: `${pkg.name}-${pkg.version}`})) {
}
}