2023-03-25 20:40:52 +01:00
|
|
|
|
|
|
|
require "./config"
|
|
|
|
|
|
|
|
module DocMachine::Builder
|
|
|
|
class Cli
|
2023-03-26 11:41:40 +02:00
|
|
|
def self.add_options(opts, args, parent_config, command)
|
2023-03-25 20:40:52 +01:00
|
|
|
config = Config.new(parent_config)
|
|
|
|
|
|
|
|
opts.on("build", "Build content and produce deliverables") do
|
|
|
|
opts.banner = [
|
|
|
|
"Usage: #{PROGRAM_NAME} build [options]",
|
|
|
|
"",
|
|
|
|
"Main options:"
|
|
|
|
].join("\n")
|
|
|
|
|
|
|
|
opts.separator ""
|
|
|
|
opts.separator "Builder Options:"
|
|
|
|
|
|
|
|
opts.on("-d", "--data-dir DIR", "Content directory") do |dir|
|
|
|
|
config.data_dir = dir
|
|
|
|
end
|
|
|
|
|
|
|
|
opts.on("-a", "--action ACTION", "Action (watch, build, shell, etc.)") do |action|
|
|
|
|
config.action = action
|
|
|
|
end
|
|
|
|
|
|
|
|
opts.on("-t", "--tty", "Enable TTY mode (needed for shell)") do
|
|
|
|
config.enable_tty = true
|
|
|
|
end
|
2023-03-26 11:41:40 +02:00
|
|
|
|
|
|
|
command << ->() : Nil do
|
|
|
|
app = DocMachine::Builder::Run.new(config)
|
|
|
|
app.prepare
|
|
|
|
app.start
|
|
|
|
app.wait
|
|
|
|
end
|
2023-03-25 20:40:52 +01:00
|
|
|
end
|
2023-03-26 11:41:40 +02:00
|
|
|
|
2023-03-25 20:40:52 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|