2023-03-25 20:40:52 +01:00
|
|
|
require "./config"
|
2023-03-27 16:01:20 +02:00
|
|
|
require "./run"
|
2023-03-25 20:40:52 +01:00
|
|
|
|
2023-04-23 15:59:29 +02:00
|
|
|
module DocMachine::Write
|
2023-03-27 16:01:20 +02:00
|
|
|
class Cli
|
|
|
|
def self.add_options(opts, args, parent_config, commands)
|
|
|
|
config = Config.new(parent_config)
|
2023-03-25 20:40:52 +01:00
|
|
|
|
2023-04-23 15:59:29 +02:00
|
|
|
opts.on("write", "Write content target for plan (beta)") do
|
2023-03-27 16:01:20 +02:00
|
|
|
opts.banner = "Usage: #{PROGRAM_NAME} scaffold [options] TARGET"
|
|
|
|
|
|
|
|
opts.on("-f", "--force", "Don't ask for confirmation") do
|
|
|
|
config.force = true
|
2023-03-25 20:40:52 +01:00
|
|
|
end
|
2023-03-26 11:41:40 +02:00
|
|
|
|
2023-03-27 16:01:20 +02:00
|
|
|
commands << ->() : Nil do
|
|
|
|
if args.size < 1
|
|
|
|
STDERR.puts "ERROR: No target given!"
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
config.target_directory = args[0]
|
|
|
|
|
2023-04-23 15:59:29 +02:00
|
|
|
app = DocMachine::Write::Run.new(config)
|
2023-03-27 16:01:20 +02:00
|
|
|
app.prepare
|
|
|
|
app.start
|
|
|
|
app.wait
|
2023-03-26 11:41:40 +02:00
|
|
|
end
|
2023-03-25 20:40:52 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-04-23 15:59:29 +02:00
|
|
|
|