#!/usr/bin/env ruby require 'twee2' class Twee2CLI < Thor package_name 'Twee2' map '-h' => :help map '--help' => :help desc 'build [INPUT] [OUTPUT]', 'compiles a Twee-like file into Twee2-like output' method_option :format, type: :string, default: Twee2::DEFAULT_FORMAT def build(input, output) Twee2::build(input, output, options) end desc 'watch', 'like "build", but watches for changes and automatically rebuilds on the fly' method_option :format, type: :string, default: Twee2::DEFAULT_FORMAT def watch(input, output) Twee2::watch(input, output, options) end desc 'formats', 'lists understood output formats' def formats Twee2::formats end desc 'decompile [URL] [OUTPUT]', 'reverse-engineers Twee2/Twine 2 HTML output into a Twee2 source file' def decompile(url, output) Twee2::decompile(url, output) end desc 'version', "reports which version you're using and checks what the highest available version is" def version Twee2::version_check end desc 'help', 'shows usage instructions' def help Twee2::help end default_task :help end Twee2CLI.start