Skip to content

Commit

Permalink
Dropped the dependency on Commander.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Sep 2, 2022
1 parent 1fce2b9 commit 467c700
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 45 deletions.
32 changes: 25 additions & 7 deletions bin/mc2it_card.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
#!/usr/bin/env node
import console from "node:console";
import {program} from "commander";
import {parseArgs} from "node:util";
import pkg from "../package.json" assert {type: "json"};
import {getCard} from "../src/index.js";

// The usage information.
const usage = `
Print the business card of MC2IT, distribution and services.
Usage:
npx @mc2it/card
Options:
-h, --help Display this help.
-v, --version Output the version number.
`;

// Start the application.
program.name("npx @mc2it/card")
.description("Print the business card of MC2IT, distribution and services.")
.version(pkg.version, "-v, --version")
.action(() => console.log(getCard(1)))
.parse();
try {
const {values} = parseArgs({options: {
help: {short: "h", type: "boolean"},
version: {short: "v", type: "boolean"}
}});

console.log(values.help ? usage.trim() : (values.version ? pkg.version : getCard(1)));
}
catch (error) {
console.error(error instanceof Error ? error.message : error);
process.exit(1);
}
1 change: 1 addition & 0 deletions docs/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ ul.tsd-type-parameter-list h5 {
background: var(--color-background-secondary);
border-bottom: 1px var(--color-accent) solid;
transition: transform 0.3s ease-in-out;
margin: 0 auto;
}
.tsd-page-toolbar a {
color: var(--color-text);
Expand Down
56 changes: 21 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "@mc2it/card",
"repository": "github:mc2it/card",
"type": "module",
"version": "3.1.0",
"version": "3.1.1",
"author": {
"email": "[email protected]",
"name": "MC2IT",
Expand All @@ -24,8 +24,7 @@
],
"dependencies": {
"boxen": "^7.0.0",
"chalk": "^5.0.1",
"commander": "^9.4.0"
"chalk": "^5.0.1"
},
"devDependencies": {
"@babel/eslint-parser": "^7.18.9",
Expand Down

0 comments on commit 467c700

Please sign in to comment.