feat(git): allow adding all files#81
Conversation
a31a874 to
21a2e58
Compare
|
rebased |
ea66c8c to
00b5264
Compare
feat: Implement 'addAll' CLI flag feat: Add `buildAddAllCommitCommand` helper feat: Execute `git add --all` when `addAll` is enabled docs: Update README with `addAll` config option
113502f to
8e54e1b
Compare
stefanlogue
left a comment
There was a problem hiding this comment.
This isn't functionality I originally had in mind for meteor, I always envisioned it would be a simple tool that does one job, creating conventional commit messages. That said, as this is hidden behind a flag and does not alter any other logic, I'm happy for this to be included as I can see how some people might use this option.
A couple of changes needed:
| flag.BoolVarP(&skipIntro, "skip-intro", "s", false, "skip intro splash") | ||
| flag.BoolVarP(&debugMode, "debug", "D", false, "enable debug mode") | ||
| flag.BoolVarP(&skipBreakingChange, "skip-breaking-change", "b", false, "skip breaking change prompt") | ||
| flag.BoolVarP(&addAll, "add-all", "a", false, "add all files to commit") |
There was a problem hiding this comment.
Should this read "add all unstaged changes to commit"?
| if config.AddAll { | ||
| rawCommitCommand, printableCommitCommand := buildCommitCommand(newCommit.Message, newCommit.Body, args) | ||
| err = commit(rawCommitCommand) | ||
| if err != nil { | ||
| writeToClipboard(printableCommitCommand) | ||
| fail( | ||
| "\n%s\n%s\n\n%s\n\n", | ||
| color.RedString(fmt.Sprintf("It looks like the add all failed.\nError: %s", err)), | ||
| color.YellowString("To run it again without going through meteor's wizard, simply run the following command (I've copied it to your clipboard!):"), | ||
| color.BlueString(printableCommitCommand), | ||
| ) | ||
| return | ||
| } | ||
| } |
There was a problem hiding this comment.
Have you called the wrong build function here? buildAddAllCommitCommand is never used and the usage of buildCommitCommand here is identical to the code below this block, leaving this code unnecessary as-is
There was a problem hiding this comment.
also, osargs are probably tailored to the commit functinality and make no sense in buildAddAllCommitCommand
| } | ||
|
|
||
| // buildAddAllCommitCommand builds the git commit command to stage all files | ||
| func buildAddAllCommitCommand(msg string, body string, osArgs []string) ([]string, string) { |
There was a problem hiding this comment.
msg and body are unused, we should remove them. Also, this function is not used, but I'm assuming you meant to use it in the conditional block in main.go?
There was a problem hiding this comment.
also, osargs are probably tailored to the commit functinality and make no sense in buildAddAllCommitCommand
There was a problem hiding this comment.
It would be nice to also have some explanation in the readme for what this flag (and the other new one) actually does
|
Will look tomorrow. Maybe let's have a small overview what I want to contribute:
Would those additions still be OK for you? @stefanlogue |
|
I took way longer until I found time to address requested changes, @stefanlogue sorry for that |
| } | ||
|
|
||
| // buildAddAllCommitCommand builds the git commit command to stage all files | ||
| func buildAddAllCommitCommand() ([]string, string) { |
There was a problem hiding this comment.
If we merge the other PR first, we can use the executeGitCommand function to wrap this instead
-add-all or addAll in config to have all unstaged changes added automatically before comitting