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, #color?, #colorize, #context, #context_requiring_sorbet!, #cyan, #exec_path, #gray, #green, #highlight, #red, #say, #say_error, #yellow

Methods included from Spoom::Colorize

#set_color

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/spoom/cli.rb', line 72

def exit_on_failure?
  true
end

Instance Method Details

#__print_versionObject



65
66
67
# File 'lib/spoom/cli.rb', line 65

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
# File 'lib/spoom/cli.rb', line 43

def files
  context = context_requiring_sorbet!
  files = context.srb_files

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

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

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