Sha256: 820a77f9f46db27d68b9d0067e4536ac4b7b9682253d2b159c7f4f22adacf1ae

Contents?: true

Size: 1.78 KB

Versions: 2

Compression:

Stored size: 1.78 KB

Contents

#!/usr/bin/env ruby

require 'trollop'
require 'web_translate_it'

SUB_COMMANDS = %w(pull push add addlocale server stats status st autoconf init)
global_options = Trollop::options do
  banner <<-EOS
  wti is a command line tool to sync your local translation files
  with the WebTranslateIt.com service.

  Usage:
         wti <command> [options]+
  
  <command> is one of: #{SUB_COMMANDS.join(" ")}
  [options] are:
  EOS
  version "Web Translate It v#{WebTranslateIt::Util.version}"
  opt :config, "Path to a translation.yml file", :short => "-c", :default => "config/translation.yml"
  stop_on SUB_COMMANDS
end

command = ARGV.shift # get the subcommand
command_options = case command
  when "pull"
    Trollop::options do
      opt :locale, "ISO code of locale(s) to pull", :type => :string
      opt :all,    "Pull all files"
      opt :force,  "Force pull (bypass conditional requests to WTI)"
    end
  when "push"
    Trollop::options do
      opt :locale, "ISO code of locale(s) to push", :type => :string
      opt :all,    "Upload all files"
      opt :low_priority, "WTI will process this file with a low priority"
      opt :merge,  "Force WTI to merge this file"
      opt :ignore_missing, "Force WTI to not obsolete missing strings"
      opt :label,  "Apply a label to the changes", :type => :string
    end
  when "add"
  when "addlocale"
  when "server"
    Trollop::options do
      opt :port, "Run server on a specific port", :default => 4000, :short => "-p"
      opt :host, "Run server on a specific host", :default => "0.0.0.0", :short => "-h"
    end
  when "stats"
  when "status"
  when "st"
  when "autoconf"
  when "init"
  else
    Trollop::die "unknown subcommand #{command.inspect}"
  end

WebTranslateIt::CommandLine.new(command, command_options, global_options, ARGV, File.expand_path("."))

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
web_translate_it-1.7.2.1 bin/wti
web_translate_it-1.7.2.0 bin/wti