diff --git a/dist/cli.js b/dist/cli.js index 6ee5b69..e75332b 100755 --- a/dist/cli.js +++ b/dist/cli.js @@ -55,13 +55,13 @@ var node_emoji_1 = __importDefault(require("node-emoji")); clear_1.default(); console.log(chalk_1.default.rgb(255, 22, 84)(figlet_1.default.textSync("Stalk", { font: "ANSI Shadow", - }))); + }) + chalk_1.default.bold(" v1.0.0"))); if (process_1.default.argv.length !== 3) { console.log(chalk_1.default.bold("Usage:")); console.log(chalk_1.default.whiteBright(" stalk [username]")); return [2 /*return*/]; } - if (["--help", "-h"].includes(process_1.default.argv[2])) { + if (["--help", "-h", "--version", "-v"].includes(process_1.default.argv[2])) { console.log(chalk_1.default.bold("Usage:")); console.log(chalk_1.default.whiteBright(" stalk [username]")); return [2 /*return*/]; @@ -88,7 +88,7 @@ var node_emoji_1 = __importDefault(require("node-emoji")); printPair("Location", user.location); printPair("Works At", user.company); printPair("Blog", user.blog); - printPair("Joined", user.created_at); + printPair("Joined", beautifyDate(user.created_at)); printPair("Looking for a job?", user.hireable ? "Yes" : "No"); printPair("Repos", user.public_repos.toString()); printPair("Followers", user.followers.toString()); @@ -102,3 +102,10 @@ function printPair(left, right) { console.log(chalk_1.default.bold.green(left) + ": " + right); } } +function beautifyDate(s) { + return new Date(s).toLocaleDateString([], { + month: "short", + day: "numeric", + year: "numeric" + }); +} diff --git a/src/cli.ts b/src/cli.ts index c78ccb9..e1d629a 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -34,7 +34,7 @@ type User = { )( figlet.textSync("Stalk", { font: "ANSI Shadow", - }) + }) + chalk.bold(" v1.0.0") ) ); if (process.argv.length !== 3) { @@ -43,7 +43,7 @@ type User = { return; } - if (["--help", "-h"].includes(process.argv[2])) { + if (["--help", "-h", "--version", "-v"].includes(process.argv[2])) { console.log(chalk.bold("Usage:")); console.log(chalk.whiteBright(" stalk [username]")); return; @@ -79,7 +79,7 @@ type User = { printPair("Location", user.location); printPair("Works At", user.company); printPair("Blog", user.blog); - printPair("Joined", user.created_at); + printPair("Joined", beautifyDate(user.created_at)); printPair("Looking for a job?", user.hireable ? "Yes" : "No"); printPair("Repos", user.public_repos.toString()); printPair("Followers", user.followers.toString()); @@ -91,3 +91,11 @@ function printPair(left: string, right: string) { console.log(`${chalk.bold.green(left)}: ${right}`); } } + +function beautifyDate(s: string): string { + return new Date(s).toLocaleDateString([], { + month: "short", + day: "numeric", + year: "numeric", + }); +}