Skip to content

Commit 9d5d784

Browse files
committed
Use short options when running shfmt
Long options are not supported in shfmt <= 3.5.0. Ubuntu 22.04 packages shfmt 3.4.3.
1 parent 8372fe7 commit 9d5d784

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/src/shfmt/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export class Formatter {
6666
shfmtConfig?: Record<string, string | boolean> | null,
6767
): Promise<string> {
6868
const indentation: number = formatOptions?.insertSpaces ? formatOptions.tabSize : 0
69-
const args: string[] = [`--indent=${indentation}`]
70-
if (shfmtConfig?.binaryNextLine) args.push('--binary-next-line')
71-
if (shfmtConfig?.caseIndent) args.push('--case-indent')
72-
if (shfmtConfig?.funcNextLine) args.push('--func-next-line')
73-
if (shfmtConfig?.spaceRedirects) args.push('--space-redirects')
69+
const args: string[] = [`-i=${indentation}`] // --indent
70+
if (shfmtConfig?.binaryNextLine) args.push('-bn') // --binary-next-line
71+
if (shfmtConfig?.caseIndent) args.push('-ci') // --case-indent
72+
if (shfmtConfig?.funcNextLine) args.push('-fn') // --func-next-line
73+
if (shfmtConfig?.spaceRedirects) args.push('-sr') // --space-redirects
7474

7575
logger.debug(`Shfmt: running "${this.executablePath} ${args.join(' ')}"`)
7676

0 commit comments

Comments
 (0)