Skip to content

Commit

Permalink
feat: Add --debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Oct 25, 2019
1 parent f598c93 commit 3f4ae24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ const yargs = require('yargs')
describe: 'skip publishing',
type: 'boolean'
})
.option('debug', {
describe: 'output debugging information',
type: 'boolean'
})
.option('cwd', {
requiresArg: true,
alias: 'c',
Expand All @@ -62,4 +66,9 @@ const yargs = require('yargs')
.alias('help', 'h')
.demandOption(['prefix', 'message', 'branch']);

if (yargs.argv.debug) {
// Debug must be enabled before other requires in order to work
require('debug').enable('git-snapshot:*');
}

module.exports = yargs;
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const chalk = require('chalk');
const debug = require('debug')('git-snapshot');
const debug = require('debug')('git-snapshot:');
const fs = require('fs-extra');
const tempy = require('tempy');
const git = require('./lib/git');
Expand Down
2 changes: 1 addition & 1 deletion lib/git.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const chalk = require('chalk');
const debug = require('debug')('git');
const debug = require('debug')('git-snapshot:git');
const execa = require('execa');

/**
Expand Down

0 comments on commit 3f4ae24

Please sign in to comment.