Skip to content

feat(git): allow adding all files#81

Open
sascha-andres wants to merge 4 commits into
stefanlogue:mainfrom
sascha-andres:allow-add-all-files
Open

feat(git): allow adding all files#81
sascha-andres wants to merge 4 commits into
stefanlogue:mainfrom
sascha-andres:allow-add-all-files

Conversation

@sascha-andres

@sascha-andres sascha-andres commented Sep 23, 2025

Copy link
Copy Markdown

-add-all or addAll in config to have all unstaged changes added automatically before comitting

@sascha-andres

Copy link
Copy Markdown
Author

rebased

Sascha Andres added 2 commits September 24, 2025 11:56
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

@stefanlogue stefanlogue left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Comment thread main.go Outdated
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")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this read "add all unstaged changes to commit"?

Comment thread main.go
Comment on lines +313 to +326
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
}
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, osargs are probably tailored to the commit functinality and make no sense in buildAddAllCommitCommand

Comment thread git.go Outdated
}

// buildAddAllCommitCommand builds the git commit command to stage all files
func buildAddAllCommitCommand(msg string, body string, osArgs []string) ([]string, string) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, osargs are probably tailored to the commit functinality and make no sense in buildAddAllCommitCommand

Comment thread README.md

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to also have some explanation in the readme for what this flag (and the other new one) actually does

@sascha-andres

Copy link
Copy Markdown
Author

Will look tomorrow. Maybe let's have a small overview what I want to contribute:

  • another flag to automatically push if wanted
  • scope regex to extract a ticket number from the branch name (at my employer we use ticket no = scope for better tracking)

Would those additions still be OK for you? @stefanlogue

@sascha-andres

sascha-andres commented Oct 11, 2025

Copy link
Copy Markdown
Author

I took way longer until I found time to address requested changes, @stefanlogue sorry for that

Comment thread git.go
}

// buildAddAllCommitCommand builds the git commit command to stage all files
func buildAddAllCommitCommand() ([]string, string) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we merge the other PR first, we can use the executeGitCommand function to wrap this instead

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.

2 participants