Skip to content

Commit

Permalink
feat: stop loging twice
Browse files Browse the repository at this point in the history
  • Loading branch information
vafanassieff committed May 28, 2022
1 parent e96f2c2 commit 1af1d7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import 'zx/globals'
import console from 'node:console'
import fs from 'node:fs/promises'
import path from 'node:path'
import process from 'node:process'
import { URL } from 'node:url'

import { Command } from 'commander'

Expand All @@ -18,6 +21,12 @@ const provider = new Command('provider')

$.verbose = false

const { version } = await fs
.readFile(
path.join(new URL('.', import.meta.url).pathname, '../package.json')
)
.then(JSON.parse)

provider
.command('configure')
.description('Configure a provider')
Expand All @@ -30,7 +39,7 @@ provider
.argument('<provider>', 'Provider to use')
.action(set)

program.name('email-alias').description('Manage email alias').version('0.1.0')
program.name('email-alias').description('Manage email alias').version(version)

program.command('list').description('List current alias').action(list)

Expand All @@ -54,6 +63,10 @@ program.exitOverride()
try {
await program.parseAsync(process.argv)
} catch (error) {
console.error(error.message)
process.exit(-1)
if (error.constructor.name === 'CommanderError') {
process.exit(error.exitCode)
} else {
console.error(error.message)
process.exit(-1)
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vafanassieff/email-alias",
"version": "0.1.2",
"version": "0.1.3",
"description": "Create a email alias to keep you real email hidden !",
"main": "src/index.js",
"repository": {
Expand Down

0 comments on commit 1af1d7e

Please sign in to comment.