diff --git a/Commands/Fmt.tmCommand b/Commands/Fmt.tmCommand index 43ee67e..9234d85 100644 --- a/Commands/Fmt.tmCommand +++ b/Commands/Fmt.tmCommand @@ -3,13 +3,12 @@ beforeRunningCommand - saveModifiedFiles + nop command - #!/usr/bin/env ruby18 + #!/usr/bin/env bash +. "${TM_SUPPORT_PATH}/lib/bash_init.sh" -require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" -Go::gofmt - +(eval "${TM_GOFMT:-gofmt}") || exit_show_tool_tip input document inputFormat diff --git a/Support/gomate.rb b/Support/gomate.rb index d344aac..a6c9d83 100755 --- a/Support/gomate.rb +++ b/Support/gomate.rb @@ -70,24 +70,4 @@ def Go::godoc TextMate.exit_show_tool_tip(err) end end - - def Go::gofmt - # TextMate's special TM_GOFMT or expect 'gofmt' on PATH - gofmt_cmd = ENV['TM_GOFMT'] || 'gofmt' - TextMate.save_if_untitled('go') - - args = [] - args.push(gofmt_cmd) - args.push(ENV['TM_FILEPATH']) - - out, err = TextMate::Process.run(*args) - - if err.nil? || err == '' - puts out - else - args << {:use_hashbang => false, :version_args => ['version'], :version_regex => /\Ago version (.*)/} - TextMate::Executor.run(*args) - TextMate.exit_show_html - end - end end