Skip to content

Various QoL improvements#35

Merged
heyodai merged 4 commits intomainfrom
21-detect-if-user-has-no-staged-changes
Nov 8, 2023
Merged

Various QoL improvements#35
heyodai merged 4 commits intomainfrom
21-detect-if-user-has-no-staged-changes

Conversation

@heyodai
Copy link
Copy Markdown
Owner

@heyodai heyodai commented Nov 8, 2023

#6, #19, #21

Added a new `check_git_status()` function to verify if there are changes staged for commit in the Git repository. The function runs `git status` command and checks if the output contains the "no changes added to commit" message. If there are no staged changes, the `run_magic_commit()` function returns a warning message to prompt the user to stage some changes before running `magic-commit`.

This enhancement ensures that the `magic-commit` script is only executed when there are changes ready to be committed, preventing accidental commits without any changes.

Modified Files:
- `magic_commit/magic_commit.py`: Added `check_git_status()` function.
- `requirements.txt`: Added new package `docutils` (version 0.20.1).

Closes #21
Revised the installation instructions in the README.md file to include the proper command for installing the package via PyPI. Changed the previous instruction for installing the package using Homebrew on Mac to a universal instruction for all platforms, using `pip install magic-commit`. Also added the link to the PyPI page for the package for more information.

This change improves the clarity and accuracy of the installation instructions for users.
Updated the version number in the `setup.py` file from 0.4.0 to 0.5.0.
Modified the `run_magic_commit()` function in `magic_commit.py` to include the `start` and `ticket` arguments. These arguments are used as inputs to the `generate_commit_message()` function, allowing the user to provide the start of the commit message and link a GitHub issue in the generated commit message. This enhancement provides more flexibility and customization options for the generated commit message.

Changes:
- Added `start` and `ticket` arguments to the `run_magic_commit()` function signature.
- Passed the `start` and `ticket` arguments to the `generate_commit_message()` function.

Example usage:
```
python -m magic_commit --start "Refactor code" --ticket 1234
```
This command will generate a commit message that starts with "Refactor code" and includes a link to GitHub issue #1234.

Note: The `start` argument and the `ticket` argument are optional. If not provided, the commit message will be generated without a specific start or ticket.

Closes #6 and #19
@heyodai heyodai linked an issue Nov 8, 2023 that may be closed by this pull request
@heyodai heyodai merged commit f444c37 into main Nov 8, 2023
@heyodai heyodai deleted the 21-detect-if-user-has-no-staged-changes branch November 8, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect if user has no staged changes

1 participant