Skip to content

Commit daa2883

Browse files
feat(main): add configurable shell option (#50)
--------- Co-authored-by: Erik Verduin <everduin94@gmail.com>
1 parent f62cdd4 commit daa2883

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ Any property can be removed from the config, it will be replaced by the default
213213
},
214214
"branch_description": {
215215
"max_length": 70
216+
},
217+
"overrides": {
218+
"shell": "/bin/sh"
216219
}
217220
}
218221
```
@@ -280,3 +283,11 @@ You can add this badge to your repository to display that you're using a better-
280283

281284
`TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)`. This may happen because you're running something like git-bash on Windows. Try another terminal/command-prompt or `winpty` to see if its still an issue.
282285

286+
If your are having issues with multilines for commits on windows, you can override the shell via config.
287+
288+
Example.
289+
```
290+
"overrides": {
291+
"shell": "c:\\Program Files\\Git\\bin\\bash.exe"
292+
}
293+
```

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ export async function main(config: z.infer<typeof Config>) {
220220
}
221221

222222
try {
223-
const output = execSync(`git commit -m "${build_commit_string(commit_state, config, false)}"`).toString().trim();
223+
const options = config.overrides.shell ? { shell: config.overrides.shell } : {}
224+
const output = execSync(`git commit -m "${build_commit_string(commit_state, config, false)}"`, options).toString().trim();
224225
if (config.print_commit_output) p.log.info(output)
225226
} catch(err) {
226227
p.log.error('Something went wrong when committing: ' + err)

src/zod-state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const Config = z.object({
9191
branch_description: z.object({
9292
max_length: z.number().positive().default(70)
9393
}).default({}),
94+
overrides: z.object({ shell: z.string().optional() }).default({})
9495
}).default({})
9596

9697
export const CommitState = z.object({

0 commit comments

Comments
 (0)