Skip to content

Commit

Permalink
Add --version / -V flag to mo-fmt (#136)
Browse files Browse the repository at this point in the history
* Add '--version' / '-V' flag to mo-fmt

* Update package-lock.json
  • Loading branch information
rvanasa authored Aug 26, 2024
1 parent c4b19fa commit 98aad8d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier-plugin-motoko",
"version": "0.9.3",
"version": "0.9.4",
"description": "A code formatter for the Motoko smart contract language.",
"main": "lib/environments/node.js",
"browser": "lib/environments/web.js",
Expand Down
18 changes: 9 additions & 9 deletions packages/mo-fmt/package-lock.json

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

4 changes: 2 additions & 2 deletions packages/mo-fmt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mo-fmt",
"version": "0.9.3",
"version": "0.9.4",
"description": "An easy-to-use Motoko formatter command.",
"main": "src/cli.js",
"bin": {
Expand All @@ -22,7 +22,7 @@
"commander": "^9.4.0",
"fast-glob": "^3.2.11",
"prettier": "2",
"prettier-plugin-motoko": "^0.9.3"
"prettier-plugin-motoko": "^0.9.4"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.2",
Expand Down
8 changes: 7 additions & 1 deletion packages/mo-fmt/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const glob = require('fast-glob');

// console.log(prettier.getSupportInfo().options);

const { check, ignore } = program
const { check, ignore, version } = program
.argument('[paths...]', 'file paths to format (examples: File.mo, **/*.mo)')
.option(
'-c, --check',
Expand All @@ -19,9 +19,15 @@ const { check, ignore } = program
'file paths to ignore, comma-separated',
'**/node_modules/**/*',
)
.option('-V, --version', 'show installed version')
.parse()
.opts();

if (version) {
console.log('mo-fmt', require('../package.json').version);
process.exit(0);
}

if (!program.args.length) {
console.log(program.helpInformation());
process.exit(0);
Expand Down

0 comments on commit 98aad8d

Please sign in to comment.