lib/tapioca/cli.rb in tapioca-0.4.0 vs lib/tapioca/cli.rb in tapioca-0.4.1
- old
+ new
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-# typed: false
+# typed: true
require 'thor'
module Tapioca
class Cli < Thor
@@ -50,17 +50,36 @@
# Add your extra requires here
CONTENT
end
end
+ desc "require", "generate the list of files to be required by tapioca"
+ def require
+ Tapioca.silence_warnings do
+ generator.build_requires
+ end
+ end
+
desc "todo", "generate the list of unresolved constants"
def todo
Tapioca.silence_warnings do
generator.build_todos
end
end
+ desc "dsl [constant...]", "generate RBIs for dynamic methods"
+ option :generators,
+ type: :array,
+ aliases: ["--gen", "-g"],
+ banner: "generator [generator ...]",
+ desc: "Only run supplied DSL generators"
+ def dsl(*constants)
+ Tapioca.silence_warnings do
+ generator.build_dsl(constants)
+ end
+ end
+
desc "generate [gem...]", "generate RBIs from gems"
def generate(*gems)
Tapioca.silence_warnings do
generator.build_gem_rbis(gems)
end
@@ -77,10 +96,13 @@
def self.exit_on_failure?
true
end
def generator
- @generator ||= Generator.new(ConfigBuilder.from_options(options))
+ current_command = T.must(current_command_chain.first)
+ @generator ||= Generator.new(
+ ConfigBuilder.from_options(current_command, options)
+ )
end
end
end
end