Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
feat: 🎸 exit process when no files staged
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf committed May 30, 2020
1 parent 9eb8286 commit 9fb4844
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/cli.js
Expand Up @@ -25,14 +25,15 @@ const executeCommand = (command, args = [], env = process.env) => {
});
};

// eslint-disable-next-line complexity
const main = async () => {
try {
const {cliAnswers, cliOptions, passThroughParams} = parseArgs();

if (cliOptions.dryRun) {
// eslint-disable-next-line no-console
console.log('Running in dry mode.');
} else {
} else if (!passThroughParams['allow-empty']) {
try {
/**
* @author https://github.com/rodrigograca31
Expand All @@ -43,7 +44,10 @@ const main = async () => {
execSync('git diff HEAD --staged --quiet --exit-code');

// Executes the following line only if the one above didn't crash (exit code: 0)
signale.warn('No files staged!');
signale.error('No files staged!');

// eslint-disable-next-line no-process-exit
process.exit(0);
} catch (error) {
// eslint-disable no-empty
}
Expand Down

0 comments on commit 9fb4844

Please sign in to comment.