diff --git a/README.md b/README.md index 129afc6..989a259 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,18 @@ press ENTER --- +## Development + +```bash +# Build +bun run build + +# Run command +./dist/cli.js gitmo -c +``` + +--- + ### Resources used - [Conventional commit types](https://github.com/pvdlg/conventional-commit-types) diff --git a/src/utils/handleCommand.js b/src/utils/handleCommand.js index 0e25afb..980a627 100644 --- a/src/utils/handleCommand.js +++ b/src/utils/handleCommand.js @@ -59,6 +59,15 @@ const isConventionalCommit = async (commitMessage) => { }; const showCommitPrompt = async () => { + // check if there are staged changes + const status = shell.exec('git status --porcelain', { silent: true }).stdout; + // Parse the status output + const stagedChanges = status.split('\n').filter(line => line.startsWith('A ') || line.startsWith('M ')); + if (stagedChanges.length === 0) { + console.log('You have no changes staged for commit!'); + return; + } + const response = await prompts( { type: "text",