Sha256: 4c7dae2536adbb092b6b1e08c1a4c16550656016831c5140aae082dfecc101ba
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
#!/usr/bin/env ruby require 'csv' require 'expandsync' require 'fileutils' require 'methadone' require 'nokogiri' require 'optparse' class App include Methadone::Main include Methadone::CLILogging main do |atext_filepath| begin atext = AText.new(atext_filepath, options[:a]) textexpander = TextExpander.new # Create file content (CSV for aText, XML for TextExpander) # that contains the correct data: # 1. aText CSV should contain any new TextExpander snippets. # 2. TextExpander XML should contain original snippets *and* # any new aText snippets. combined_snippets = (atext.snippets + textexpander.snippets).uniq { |s| s[0] } atext.construct_data(combined_snippets - atext.snippets) textexpander.construct_data(combined_snippets - textexpander.snippets) # Save new aText snippets . atext.save # Backup the original TextExpander file (unless the user has specified # that they don't want a backup) and save the new one. textexpander.backup unless options[:n] textexpander.save # This has to be here so that my Cucumber Aruba tests work. Don't ask why. leak_exceptions(true) rescue StandardError => e ExpandSync::CLIMessage.error(e, false) exit!(1) end end description ExpandSync::DESCRIPTION version ExpandSync::VERSION # Flags & Switches on('-a FILEPATH', "Output location for aText rules (defaults to ~/#{ AText::OUTPUT_FILENAME })") on('-n', 'Disable backing up of Settings.textexpander (RUN AT YOUR OWN RISK!)') on('-v', '--verbose', 'Turn on verbose output') # Arguments arg :atext_filepath, 'The filepath to a CSV file exported from aText' go! end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
expandsync-0.1.3 | bin/expandsync |
expandsync-0.1.2 | bin/expandsync |
expandsync-0.1.1 | bin/expandsync |