spotless icon indicating copy to clipboard operation
spotless copied to clipboard

shfmt - support simplifying (`-s`) and minifying flags (`-mn`)

Open tbcrawford opened this issue 1 year ago • 0 comments

shfmt supports simplifying and/or minifying shell scripts. However, there is no support provided via .editorconfig for the flags. So we'll need some additional configuration in the shfmt Gradle DSL to enable these.

My thoughts are something akin to one of the following:

Option 1

// Provides future extensible flexibility and follows the lead set by the `ktfmt` configuration
spotless {
  shell {
    shfmt().configure {
      it.minify = true
      it.simplify = true
    }
  }
}

Option 2

// If any other options become available in the future, this seems to be less extensible, however, it is very readable
spotless {
  shell {
    shfmt()
      .minify()
      .simplify()
  }
}

Note that minifying the code implies simplifying the code. So both flags can probably be true, but both flags aren't required to simplify and minify.

tbcrawford avatar Jan 31 '24 01:01 tbcrawford