Class: Spoom::Cli::Main

Inherits:
Thor
  • Object
show all
Extended by:
T::Sig
Includes:
Helper
Defined in:
lib/spoom/cli.rb

Constant Summary

Constants included from Helper

Helper::HIGHLIGHT_COLOR

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helper

#blue, #check_sorbet_segfault, #color?, #colorize, #cyan, #exec_path, #gray, #green, #highlight, #in_sorbet_project!, #in_sorbet_project?, #red, #say, #say_error, #sorbet_config, #sorbet_config_file, #yellow

Methods included from Spoom::Colorize

#set_color

Class Method Details

.exit_on_failure?Boolean

Utils

Returns:

  • (Boolean)

74
75
76
# File 'lib/spoom/cli.rb', line 74

def self.exit_on_failure?
  true
end

Instance Method Details

#__print_versionObject


68
69
70
# File 'lib/spoom/cli.rb', line 68

def __print_version
  puts "Spoom v#{Spoom::VERSION}"
end

#filesObject


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/spoom/cli.rb', line 43

def files
  in_sorbet_project!

  path = exec_path
  config = sorbet_config
  files = Spoom::Sorbet.srb_files(config, path: path)

  unless options[:rbi]
    files = files.reject { |file| file.end_with?(".rbi") }
  end

  if files.empty?
    say_error("No file matching `#{sorbet_config_file}`")
    exit(1)
  end

  if options[:tree]
    tree = FileTree.new(files, strip_prefix: path)
    tree.print(colors: options[:color], indent_level: 0)
  else
    puts files
  end
end