mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:19:44 +08:00 
			
		
		
		
	cmd: make caddy fmt hints more clear (#5378)
				
					
				
			This commit is contained in:
		| @ -88,7 +88,7 @@ func FormattingDifference(filename string, body []byte) (caddyconfig.Warning, bo | |||||||
| 	return caddyconfig.Warning{ | 	return caddyconfig.Warning{ | ||||||
| 		File:    filename, | 		File:    filename, | ||||||
| 		Line:    line, | 		Line:    line, | ||||||
| 		Message: "Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies", | 		Message: "Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies", | ||||||
| 	}, true | 	}, true | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -589,7 +589,10 @@ func cmdFmt(fl Flags) (int, error) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if warning, diff := caddyfile.FormattingDifference(formatCmdConfigFile, input); diff { | 	if warning, diff := caddyfile.FormattingDifference(formatCmdConfigFile, input); diff { | ||||||
| 		return caddy.ExitCodeFailedStartup, fmt.Errorf("%s:%d: Caddyfile input is not formatted", warning.File, warning.Line) | 		return caddy.ExitCodeFailedStartup, fmt.Errorf(`%s:%d: Caddyfile input is not formatted; Tip: use '--overwrite' to update your Caddyfile in-place instead of previewing it. Consult '--help' for more options`, | ||||||
|  | 			warning.File, | ||||||
|  | 			warning.Line, | ||||||
|  | 		) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return caddy.ExitCodeSuccess, nil | 	return caddy.ExitCodeSuccess, nil | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Emily Lange
					Emily Lange