Merge pull request #881 from nolange/fix_cmake_presets
_cmake: fix cmake presets for real
This commit is contained in:
		
						commit
						11258bcd48
					
				
							
								
								
									
										13
									
								
								src/_cmake
								
								
								
								
							
							
						
						
									
										13
									
								
								src/_cmake
								
								
								
								
							|  | @ -141,14 +141,13 @@ _cmake_generator_options() { | ||||||
| # -------------- | # -------------- | ||||||
| (( $+functions[_cmake_presets] )) || | (( $+functions[_cmake_presets] )) || | ||||||
| _cmake_presets() { | _cmake_presets() { | ||||||
|   # TODO: Problems with quotes need eval |   local invoke; invoke=(${(Q)words}) | ||||||
|   # would need a way to exec the array |   invoke[$CURRENT]=() | ||||||
|   local -a list_presets; |   # TODO: remove all arguments -* except -S | ||||||
| 
 | 
 | ||||||
|   if [[ -e CMakePresets.json ]]; then |   local list_presets; list_presets=(${(f)"$(${invoke} --list-presets 2>/dev/null | | ||||||
|     # some old projects uses BOM in json file. strip UTF-8 BOM and then parse JSON |     sed -n -e 's,^[[:space:]]*"\([^"]*\)"[[:space:]]*-[[:space:]]*\(.*\),\1:\2,p' \ | ||||||
|     list_presets=("${(@f)$(sed '1s/^\xEF\xBB\xBF//' < CMakePresets.json | perl -0777 -MJSON::PP -nE 'do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$_->{name}:$_->{description}\n"} for @{decode_json($_)->{configurePresets}}' 2>/dev/null)}") |            -e 's,^[[:space:]]*"\([^"]*\)"[[:space:]]*$,\1,p')"}) | ||||||
|   fi |  | ||||||
| 
 | 
 | ||||||
|   _describe 'presets' list_presets |   _describe 'presets' list_presets | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue