Skip to content

Commit

Permalink
only forward git flags if they are set.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Feb 3, 2024
1 parent a33d2a7 commit 5d48c0e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ var send = &cli.Command{
// git-format-patch extra flags that will be handled directly to it
gitFormatPatchArgs := []string{"format-patch", "--stdout"}
for _, fd := range gitFormatPatchFlags {
switch flag := fd.(type) {
case *cli.StringFlag:
gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name+"="+c.String(flag.Name))
case *cli.BoolFlag:
gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name)
if fd.IsSet() {
switch flag := fd.(type) {
case *cli.StringFlag:
gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name+"="+c.String(flag.Name))
case *cli.BoolFlag:
gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name)
}
}
}

Expand Down

0 comments on commit 5d48c0e

Please sign in to comment.