Skip to content

Instantly share code, notes, and snippets.

@TrinityCoder
Last active May 18, 2019 15:50
Show Gist options
  • Save TrinityCoder/c1c011f12c54c8ee8a1121bc9c2a21cd to your computer and use it in GitHub Desktop.
Save TrinityCoder/c1c011f12c54c8ee8a1121bc9c2a21cd to your computer and use it in GitHub Desktop.
This is the original Ruby script just slightly adjusted so that it runs with today's Ruby. ORIGINAL: https://github.com/textmate/cmake.tmbundle/blob/926867a414c1125abefa38161d82d71756f591a2/Support/arg_separators.rb
#!/usr/bin/env -vS ruby -wKU
commands = `/usr/bin/env cmake --help-command-list`.lines
commands.shift # Skip version number
constants = []
commands.each do |cmd|
cmd = cmd.strip.upcase
help = `/usr/bin/env cmake --help-command #{cmd}`
help.scan(/[a-zA-Z_]+\((.+?)\)/m) do |example|
example[0].scan(/[A-Z_\d]{2,}/) do |constant|
constants << constant
end
end
end
constants.uniq.sort.each { |constant| puts constant }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment