Skip to content

Releases: mvdan/sh

v2.5.0

13 Jul 10:53
Compare
Choose a tag to compare

Highlights:

  • syntax
    • Add support for Bash's {varname}< redirects
    • Add SpaceRedirects to 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}
  • interp
    • Runner.Dir is now always an absolute path
  • shell
    • Expand now supports expanding a lone ~
    • Expand and SourceNode now have default timeouts
  • cmd/shfmt
    • Add -sr to print spaces after redirect operators
    • Don't skip empty string values in -tojson
    • Include comment positions in -tojson

Binaries built on go version go1.10.3 linux/amd64.

v2.4.0

16 May 16:40
Compare
Choose a tag to compare

Highlights:

  • Publish as a JS package, mvdan-sh
  • syntax
    • Add DebugPrint to 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= into declare foo
  • interp
    • Add support for shopt -s globstar
    • Replace Runner.Env with an interface
  • shell
    • Add Expand as a fully featured version of os.Expand
  • cmd/shfmt
    • Set appropriate exit status when -d is used

Binaries built on go version go1.10.2 linux/amd64.

v2.3.0

07 Mar 21:15
Compare
Choose a tag to compare

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}
  • cmd/shfmt
    • Add -d, to display diffs when formatting differs
    • Promote -exp.tojson to -tojson
    • Add Pos and End fields to nodes in -tojson
    • Inline StmtList fields to simplify the -tojson output
    • Support -l on standard input

Binaries built on go version go1.10 linux/amd64.

v2.2.1

25 Jan 03:14
Compare
Choose a tag to compare

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] to foo[x], to not break string indexes
    • Fix Stmt.End when the end token is the background operator &
    • Never apply the negation operator ! to && and || lists
    • Apply the background operator & to entire && and || lists
    • Fix StopAt when the stop string is at the beginning of the source
    • In N>word, check that N is a valid numeric literal
    • Fix a couple of crashers found via fuzzing
  • cmd/shfmt
    • Don't error if non-bash files can't be written to

Binaries built on go version go1.9.3 linux/amd64.

v2.2.0

18 Jan 12:52
Compare
Choose a tag to compare

Highlights:

  • Tests on Mac and Windows are now ran as part of CI
  • syntax
    • Add StopAt to stop lexing at a custom arbitrary token
    • Add TranslatePattern and QuotePattern for pattern matching
    • Minification support added to the printer - see Minify
    • Add ParamExp.Names to represent ${!prefix*}
    • Add TimeClause.PosixFormat for its -p flag
    • Fix parsing of assignment values containing =
    • Fix parsing of parameter expansions followed by a backslash
    • Fix quotes in parameter expansion operators like ${v:-'def'}
    • Fix parsing of negated declare attributes like declare +x name
    • Fix parsing of ${#@}
    • Reject bad parameter expansion operators like ${v@WRONG}
    • Reject inline array variables like a=(b c) prog
    • Reject indexing of special vars like ${1[3]}
    • Reject ${!name} when in POSIX mode
    • Reject multiple parameter expansion actions like ${#v:-def}
  • interp
    • Add Bash brace expansion support, including {a,b} and {x..y}
    • Pattern matching actions are more correct and precise
    • Exported some Runner internals, including Vars and Funcs
    • Use the interpreter's $PATH to find binaries
    • Roll our own globbing to use our own pattern matching code
    • Support the getopts sh builtin
    • Support the read bash builtin
    • Numerous changes to improve Windows support
  • shell
    • New experimental package with high-level utility functions
    • Add SourceFile to get the variables declared in a script
    • Add SourceNode as a lower-level version of the above
  • cmd/shfmt
    • Add -mn, which minifies programs via syntax.Minify

Binaries built on go version go1.9.2 linux/amd64.

v2.1.0

25 Nov 18:17
Compare
Choose a tag to compare

Highlights:

  • syntax
    • Add Stmts, to parse one statement at a time
    • Walk no longer ignores comments
    • Parameter expansion end fixes, such as $foo.bar
    • Whitespace alignment can now be kept - see KeepPadding
    • Introduce an internal newline token to simplify the parser
    • Fix Block.Pos to actually return the start position
    • Fix mishandling of inline comments in two edge cases
  • interp
    • Expose Fields to expand words into strings
    • First configurable modules - cmds and files
    • Add support for the new TimeClause
    • Add support for namerefs and readonly vars
    • Add support for associative arrays (maps)
    • More sh builtins: exec return
    • More bash builtins: command pushd popd dirs
    • More test operators: -b -c -t -o
    • Configurable kill handling - see KillTimeout
  • cmd/shfmt
    • Add -f to just list all the shell files found
    • Add -kp to keep the column offsets in place
  • cmd/gosh
    • Now supports a basic interactive mode

Binaries built on go version go1.9.2 linux/amd64.

v2.0.0

30 Aug 16:03
Compare
Choose a tag to compare

Highlights:

  • The package import paths were moved to mvdan.cc/sh/...
  • syntax
    • Parser and Printer structs introduced with functional options
    • Node positions are now independent - Position merged into Pos
    • All comments are now attached to nodes
    • Support mksh - MirBSD's Korn Shell, used in Android
    • Various changes to the AST:
      • EvalClause removed; eval is no longer parsed as a keyword
      • Add support for Bash's time and select
      • Merge UntilClause into WhileClause
      • Moved Stmt.Assigns to CallExpr.Assigns
      • Remove Elif - chain IfClause nodes instead
    • Support for indexed assignments like a[i]=b
    • Allow expansions in arithmetic expressions again
    • Unclosed heredocs now produce an error
    • Binary ops are kept in the same line - see BinaryNextLine
    • Switch cases are not indented by default - see SwitchCaseIndent
  • cmd/shfmt
    • Add -s, which simplifies programs via syntax.Simplify
    • Add -ln <lang>, like -ln mksh
    • Add -bn to put binary ops in the next line, like in v1
    • Add -ci to indent switch cases, like in v1
  • interp
    • Some progress made, though still experimental
    • Most of POSIX done - some builtins remain to be done

Binaries built on go version go1.8.3 linux/amd64.

v2.0-beta1

30 Jul 12:50
Compare
Choose a tag to compare
v2.0-beta1 Pre-release
Pre-release

See #144.

v1.3.1

26 May 13:50
Compare
Choose a tag to compare

Highlights:

  • syntax
    • Fix parsing of ${foo[$bar]}
    • Fix printer regression where > >(foo) would be turned into >>(foo)
    • Break comment alignment on any line without a comment, fixing formatting issues
    • Error on keywords like fi and done used as commands

Binaries built on go version go1.8.3 linux/amd64.

v1.3.0

24 Apr 16:47
Compare
Choose a tag to compare

Highlights:

  • syntax
    • Fix backslashes in backquote command substitutions
    • Disallow some test expressions like [[ a == ! b ]]
    • Disallow some parameter expansions like ${$foo}
    • Disallow some arithmetic expressions like ((1=3)) and (($(echo 1 + 2)))
    • Binary commands like &&, || and pipes are now left-associative
  • fileutil
    • CouldBeScript may now return true on non-regular files such as symlinks
  • interp
    • New experimental package to interpret a syntax.File in pure Go

Binaries built on go version go1.8.1 linux/amd64.