mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch.sh: multiline printf -> heredoc (#11351)
The following script is cut out from vim-patch.sh:
```sh
#!/usr/bin/env bash
BASENAME=vim-patch.sh
printf "\nInstructions:
To port one of the above patches to Neovim, execute this script with the patch revision as argument and follow the instructions, e.g.
'%s -p v8.0.1234', or '%s -P v8.0.1234'
NOTE: Please port the _oldest_ patch if you possibly can.
      You can use '%s -l path/to/file' to see what patches are missing for a file.
" "${BASENAME}" "${BASENAME}" "${BASENAME}"
```
The code itself should be correct, but shellcheck 0.7.0 says:
```
In /tmp/test.sh line 5:
  printf "\nInstructions:
         ^-- SC2183: This format string has 2 variables, but is passed 3 arguments.
```
We also had a problem before that a `%s` was added, but the accompanying
argument to printf was forgotten. Using a heredoc is less error-prone, since we
insert variables directly.
			
			
This commit is contained in:
		| @@ -501,13 +501,15 @@ show_vimpatches() { | ||||
|  | ||||
|   list_missing_vimpatches 1 "$@" | while read -r vim_commit; do | ||||
|     if [[ "${runtime_commits[$vim_commit]-}" ]]; then | ||||
|       printf '  • %s (+runtime)\n' "${vim_commit}" | ||||
|       printf '  • %s (+runtime)\n' "${vim_commit}" | ||||
|     else | ||||
|       printf '  • %s\n' "${vim_commit}" | ||||
|     fi | ||||
|       printf '  • %s\n' "${vim_commit}" | ||||
|   done | ||||
|  | ||||
|   cat << EOF | ||||
|  | ||||
|   printf "\nInstructions: | ||||
|  | ||||
| Instructions: | ||||
|   To port one of the above patches to Neovim, execute this script with the patch revision as argument and follow the instructions, e.g. | ||||
|   '${BASENAME} -p v8.0.1234', or '${BASENAME} -P v8.0.1234' | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Marco Hinz
					Marco Hinz