lib/spoom/cli.rb in spoom-1.0.8 vs lib/spoom/cli.rb in spoom-1.0.9
- old
+ new
@@ -36,22 +36,32 @@
desc "tc", "Run Sorbet and parses its output"
subcommand "tc", Spoom::Cli::Run
desc "files", "List all the files typechecked by Sorbet"
+ option :tree, type: :boolean, default: true, desc: "Display list as an indented tree"
+ option :rbi, type: :boolean, default: true, desc: "Show RBI files"
def files
in_sorbet_project!
path = exec_path
- config = Spoom::Sorbet::Config.parse_file(sorbet_config)
+ config = sorbet_config
files = Spoom::Sorbet.srb_files(config, path: path)
- say("Files matching `#{sorbet_config}`:")
+ unless options[:rbi]
+ files = files.reject { |file| file.end_with?(".rbi") }
+ end
+
if files.empty?
- say(" NONE")
- else
+ 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: 2)
+ tree.print(colors: options[:color], indent_level: 0)
+ else
+ puts files
end
end
desc "--version", "Show version"
def __print_version