Sha256: 79f096070169a5c6db844b14f4dcd43c94248d6dcb05b74bdbffb8bb74ea4149

Contents?: true

Size: 1.74 KB

Versions: 3

Compression:

Stored size: 1.74 KB

Contents

#!/usr/bin/env ruby

require 'trollop'
require 'web_translate_it'

SUB_COMMANDS = %w(pull push add addlocale server status st 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 "status"
  when "st"
  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

3 entries across 3 versions & 1 rubygems

Version Path
web_translate_it-1.8.0.1 bin/wti
web_translate_it-1.8.0.0 bin/wti
web_translate_it-1.7.3.1 bin/wti