Sha256: 02cc4464a71a50c7e456a77129dcefa8b658c1973efe218e92b67f0446b2d826
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
# frozen_string_literal: true require 'avm/file_formats/search_formatter' require 'avm/registry' require 'eac_cli/core_ext' module Avm module Tools class Runner class Files class Format runner_with :help do desc 'Format files.' bool_opt '-a', '--apply', 'Confirm changes.' bool_opt '-n', '--no-recursive', 'No recursive.' bool_opt '-v', '--verbose', 'Verbose' bool_opt '-d', '--dirty', 'Select modified files to format.' pos_arg :paths, repeat: true, optional: true end def run ::Avm::FileFormats::SearchFormatter.new(source_paths, formatter_options).run end def formatter_options { ::Avm::FileFormats::SearchFormatter::OPTION_APPLY => parsed.apply?, ::Avm::FileFormats::SearchFormatter::OPTION_RECURSIVE => !parsed.no_recursive?, ::Avm::FileFormats::SearchFormatter::OPTION_VERBOSE => parsed.verbose? } end def scm @scm ||= ::Avm::Registry.scms.detect('.') end def dirty_files scm.dirty_files.map { |f| scm.root_path.join(f.path) }.select(&:exist?).map(&:to_s) end def source_paths if parsed.dirty? parsed.paths + dirty_files else parsed.paths.if_present(%w[.]) end end end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
avm-tools-0.161.0 | lib/avm/tools/runner/files/format.rb |
eac_tools-0.86.5 | sub/avm-tools/lib/avm/tools/runner/files/format.rb |