Repository navigation
Releases
v2.6.4
Highlights:
- syntax
- Support array elements without values, like
declare -A x=([index]=) - Parse
for i; do ...uniquely, as it's short forfor i in "$@" - Add missing error on unclosed nested backquotes
- Support array elements without values, like
- expand
- Don't expand tildes twice, fixing
echo ~on Windows
- Don't expand tildes twice, fixing
- interp
- Fix the use of
Paramsas an option toNew - Support lowercase Windows volume names in
$PATH
- Fix the use of
Binaries built on go version go1.12 linux/amd64.
v2.6.3
v2.6.2
Highlights:
- syntax
- Avoid premature reads in
Parser.Interactivewhen parsing Unicode bytes - Fix parsing of certain Bash test expression involving newlines
Redirect.Endnow takes theHdocfield into accountValidNamenow returnsfalsefor an empty string
- Avoid premature reads in
- expand
- Environment variables on Windows are case insensitive again
- interp
- Don't crash on
declare $unset=foo - Fix a regression where executed programs would receive a broken environment
- Don't crash on
Note that the published Docker image was changed to set shfmt as the entrypoint, so previous uses with arguments like docker run mvdan/shfmt:v2.6.1 shfmt --version should now be docker run mvdan/shfmt:v2.6.2 --version.
Binaries built on go version go1.11.2 linux/amd64.
v2.6.1
v2.6.0
This is the biggest v2 release to date. It's now possible to write an interactive shell, and it's easier and safer to perform shell expansions.
This will be the last major v2 version, to allow converting the project to a Go module in v3.
Highlights:
- Go 1.10 or later required to build
- syntax
- Add
Parser.Interactiveto implement an interactive shell - Add
Parser.Documentto parse a single here-document body - Add
Parser.Wordsto incrementally parse separate words - Add the
Word.Lithelper method - Support custom indentation in
<<-heredoc bodies
- Add
- interp
- Stabilize API and add some examples
- Introduce a constructor, and redesign
Runner.Reset - Move the context from a field to function parameters
- Remove
Runner.Stmtin favor ofRunwithShellExitStatus
- shell
- Stabilize API and add some examples
- Add
Expand, as a more powerfulos.Expand - Add
Fields, similar to the oldRunner.Fields Source*functions now take a contextSource*functions no longer try to sandbox
- expand
- New package, split from
interp - Allows performing shell expansions in a controlled way
- Redesigned
EnvironandVariablemoved frominterp
- New package, split from
Binaries built on go version go1.11.2 linux/amd64.
v2.5.1
v2.5.0
Highlights:
- syntax
- Add support for Bash's
{varname}<redirects - Add
SpaceRedirectsto format redirects like> word - Parse
$\"correctly within double quotes - A few fixes where minification would break programs
- Printing of heredocs within
<()no longer breaks them - Printing of single statements no longer adds empty lines
- Error on invalid parameter names like
${1a}
- Add support for Bash's
- interp
Runner.Diris now always an absolute path
- shell
Expandnow supports expanding a lone~ExpandandSourceNodenow have default timeouts
- cmd/shfmt
- Add
-srto print spaces after redirect operators - Don't skip empty string values in
-tojson - Include comment positions in
-tojson
- Add
Binaries built on go version go1.10.3 linux/amd64.
v2.4.0
Highlights:
- Publish as a JS package, mvdan-sh
- syntax
- Add
DebugPrintto pretty-print a syntax tree - Fix comment parsing and printing in some edge cases
- Indent
<<-heredoc bodies if indenting with tabs - Add support for nested backquotes
- Relax parser to allow quotes in arithmetic expressions
- Don't rewrite
declare foo=intodeclare foo
- Add
- interp
- Add support for
shopt -s globstar - Replace
Runner.Envwith an interface
- Add support for
- shell
- Add
Expandas a fully featured version ofos.Expand
- Add
- cmd/shfmt
- Set appropriate exit status when
-dis used
- Set appropriate exit status when
Binaries built on go version go1.10.2 linux/amd64.
v2.3.0
Highlights:
- syntax
- Case clause patterns are no longer forced on a single line
- Add
ExpandBraces, to perform Bash brace expansion on words - Improve the handling of backslashes within backquotes
- Improve the parsing of Bash test regexes
- interp
- Support
$DIRSTACK,${param[@]#word}, and${param,word}
- Support
- cmd/shfmt
- Add
-d, to display diffs when formatting differs - Promote
-exp.tojsonto-tojson - Add
PosandEndfields to nodes in-tojson - Inline
StmtListfields to simplify the-tojsonoutput - Support
-lon standard input
- Add
Binaries built on go version go1.10 linux/amd64.
v2.2.1
Highlights:
- syntax
- Don't error on
${1:-default} - Allow single quotes in
${x['str key']}as well as double quotes - Add support for
${!foo[@]} - Don't simplify
foo[$x]tofoo[x], to not break string indexes - Fix
Stmt.Endwhen the end token is the background operator& - Never apply the negation operator
!to&&and||lists - Apply the background operator
&to entire&&and||lists - Fix
StopAtwhen the stop string is at the beginning of the source - In
N>word, check thatNis a valid numeric literal - Fix a couple of crashers found via fuzzing
- Don't error on
- cmd/shfmt
- Don't error if non-bash files can't be written to
Binaries built on go version go1.9.3 linux/amd64.