[git] First pass at a clean filter for Alfred workflows

pull/28/head
Alpha Chen 8 years ago
parent 4bf5d17e69
commit 55b2b904a1

@ -69,3 +69,5 @@
fetchJobs = 4
[commit]
verbose = true
[filter "alfredworkflow"]
clean = clean_alfred_workflow

@ -0,0 +1,13 @@
#!/usr/bin/env ruby
require 'rexml/document'
doc = REXML::Document.new(ARGF.read, ignore_whitespace_nodes: :all)
xpath = '//dict/key[text()="variablesdontexport"]/following-sibling::array'
vars = doc.elements[xpath].map(&:text)
vars.each do |var|
doc.elements["//key[text()='#{var}']/following-sibling::string"].text = ''
end
doc.write
Loading…
Cancel
Save