Created
November 14, 2019 21:17
-
-
Save namuan/2f646860725e2354af837e04eb9608bd to your computer and use it in GitHub Desktop.
Python one liner to extract and transform Spring HttpStatus enums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://raw.githubusercontent.com/spring-projects/spring-framework/master/spring-web/src/main/java/org/springframework/http/HttpStatus.java | \ | |
grep '\".*),' | \ | |
while read line; \ | |
do echo $line | python -c 'import re,sys; s, c, m = re.search("([\w\_]+)\((\d+),\s+\"([\w\s]+)", sys.stdin.readline()).groups(); print("{}: (\"HttpStatus.{}\", \"{}\"),".format(c, s, m))'; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment