Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/perl -lp
##Copy and paste property block to the top of the file.
##Select the properties, and run this filter on it to
##handle bulk reformatting and changes.
##Breaks on options entry.
##Does not handle conditional properties, or builder and lazy methods.
##Only translates i18n for assetName, label, hoverHelp and subtext
BEGIN { $name = shift; }
s/^\s+(\w+)\s*=>\s*{/property $1 => (/;
s/^\s+},?/ );/;
s/\t/ /g;
s/defaultValue/default /;
if (/i18n->get/ && /(?:assetName|label|hoverHelp|subtext)\s*=>/ ) {
s/\$.+\(/[/;
s/\)/, '$name']/;
}
s/^(aspect.+?),\s*$/$1;/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.