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)


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

def exit_on_failure?
  true
end

Instance Method Details

#__print_versionObject



61
62
63
# File 'lib/spoom/cli.rb', line 61

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

def files
  context = context_requiring_sorbet!

  files = context.srb_files(include_rbis: options[:rbi])
  if files.empty?
    say_error("No file matching `#{Sorbet::CONFIG_PATH}`")
    exit(1)
  end

  if options[:tree]
    tree = FileTree.new(files)
    tree.print_with_strictnesses(context, colors: options[:color])
  else
    puts files
  end
end