Add list_json()
As we now have valid CSV, pipe that into a jq filter to generate JSON. https://stackoverflow.com/a/67359273
This commit is contained in:
		
							parent
							
								
									6cba256d79
								
							
						
					
					
						commit
						ecd4ed043e
					
				
							
								
								
									
										9
									
								
								quickget
								
								
								
								
							
							
						
						
									
										9
									
								
								quickget
								
								
								
								
							|  | @ -59,7 +59,12 @@ function validate_release() { | ||||||
|   fi |   fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function list_all() { | function list_json() { | ||||||
|  |   # Reference: https://stackoverflow.com/a/67359273 | ||||||
|  |   list_csv | jq -R 'split(",") as $h|reduce inputs as $in ([]; . += [$in|split(",")|. as $a|reduce range(0,length) as $i ({};.[$h[$i]]=$a[$i])])' | ||||||
|  |   exit 0 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function list_csv() { | function list_csv() { | ||||||
|   local DISPLAY_NAME |   local DISPLAY_NAME | ||||||
|   local FUNC |   local FUNC | ||||||
|  | @ -823,6 +828,8 @@ if [ -n "${1}" ]; then | ||||||
|     OS="${1,,}" |     OS="${1,,}" | ||||||
|     if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then |     if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then | ||||||
|         list_csv |         list_csv | ||||||
|  |     elif [ "${OS}" == "list_json" ]; then | ||||||
|  |         list_json | ||||||
|     fi |     fi | ||||||
| else | else | ||||||
|     echo "ERROR! You must specify an operating system:" |     echo "ERROR! You must specify an operating system:" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue