mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	Reorganize format options of psql in alphabetical order
This makes the addition of new formats easier, and documentation lookups easier. Author: Daniel Vérité Reviewed-by: Fabien Coelho Discussion: https://postgr.es/m/alpine.DEB.2.20.1803081004241.2916@lancre
This commit is contained in:
		
							parent
							
								
									8f045e242b
								
							
						
					
					
						commit
						add9182e59
					
				| @ -2584,12 +2584,11 @@ lo_import 152801 | |||||||
|           <term><literal>format</literal></term> |           <term><literal>format</literal></term> | ||||||
|           <listitem> |           <listitem> | ||||||
|           <para> |           <para> | ||||||
|           Sets the output format to one of <literal>unaligned</literal>, |           Sets the output format to one of <literal>aligned</literal>, | ||||||
|           <literal>aligned</literal>, <literal>wrapped</literal>, |           <literal>asciidoc</literal>, <literal>html</literal>, | ||||||
|           <literal>html</literal>, <literal>asciidoc</literal>, |  | ||||||
|           <literal>latex</literal> (uses <literal>tabular</literal>), |           <literal>latex</literal> (uses <literal>tabular</literal>), | ||||||
|           <literal>latex-longtable</literal>, or |           <literal>latex-longtable</literal>, <literal>troff-ms</literal>, | ||||||
|           <literal>troff-ms</literal>. |           <literal>unaligned</literal>, or <literal>wrapped</literal>. | ||||||
|           Unique abbreviations are allowed.  (That would mean one letter |           Unique abbreviations are allowed.  (That would mean one letter | ||||||
|           is enough.) |           is enough.) | ||||||
|           </para> |           </para> | ||||||
| @ -2615,10 +2614,10 @@ lo_import 152801 | |||||||
|           </para> |           </para> | ||||||
| 
 | 
 | ||||||
|           <para> |           <para> | ||||||
|           The <literal>html</literal>, <literal>asciidoc</literal>, <literal>latex</literal>, |           The <literal>asciidoc</literal>, <literal>html</literal>, | ||||||
|           <literal>latex-longtable</literal>, and <literal>troff-ms</literal> |           <literal>latex</literal>, <literal>latex-longtable</literal>, and | ||||||
|           formats put out tables that are intended to |           <literal>troff-ms</literal> formats put out tables that are intended | ||||||
|           be included in documents using the respective mark-up |           to be included in documents using the respective mark-up | ||||||
|           language. They are not complete documents! This might not be |           language. They are not complete documents! This might not be | ||||||
|           necessary in <acronym>HTML</acronym>, but in |           necessary in <acronym>HTML</acronym>, but in | ||||||
|           <application>LaTeX</application> you must have a complete |           <application>LaTeX</application> you must have a complete | ||||||
|  | |||||||
| @ -3560,21 +3560,15 @@ _align2string(enum printFormat in) | |||||||
| 		case PRINT_NOTHING: | 		case PRINT_NOTHING: | ||||||
| 			return "nothing"; | 			return "nothing"; | ||||||
| 			break; | 			break; | ||||||
| 		case PRINT_UNALIGNED: |  | ||||||
| 			return "unaligned"; |  | ||||||
| 			break; |  | ||||||
| 		case PRINT_ALIGNED: | 		case PRINT_ALIGNED: | ||||||
| 			return "aligned"; | 			return "aligned"; | ||||||
| 			break; | 			break; | ||||||
| 		case PRINT_WRAPPED: | 		case PRINT_ASCIIDOC: | ||||||
| 			return "wrapped"; | 			return "asciidoc"; | ||||||
| 			break; | 			break; | ||||||
| 		case PRINT_HTML: | 		case PRINT_HTML: | ||||||
| 			return "html"; | 			return "html"; | ||||||
| 			break; | 			break; | ||||||
| 		case PRINT_ASCIIDOC: |  | ||||||
| 			return "asciidoc"; |  | ||||||
| 			break; |  | ||||||
| 		case PRINT_LATEX: | 		case PRINT_LATEX: | ||||||
| 			return "latex"; | 			return "latex"; | ||||||
| 			break; | 			break; | ||||||
| @ -3584,6 +3578,12 @@ _align2string(enum printFormat in) | |||||||
| 		case PRINT_TROFF_MS: | 		case PRINT_TROFF_MS: | ||||||
| 			return "troff-ms"; | 			return "troff-ms"; | ||||||
| 			break; | 			break; | ||||||
|  | 		case PRINT_UNALIGNED: | ||||||
|  | 			return "unaligned"; | ||||||
|  | 			break; | ||||||
|  | 		case PRINT_WRAPPED: | ||||||
|  | 			return "wrapped"; | ||||||
|  | 			break; | ||||||
| 	} | 	} | ||||||
| 	return "unknown"; | 	return "unknown"; | ||||||
| } | } | ||||||
| @ -3639,25 +3639,25 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) | |||||||
| 	{ | 	{ | ||||||
| 		if (!value) | 		if (!value) | ||||||
| 			; | 			; | ||||||
| 		else if (pg_strncasecmp("unaligned", value, vallen) == 0) |  | ||||||
| 			popt->topt.format = PRINT_UNALIGNED; |  | ||||||
| 		else if (pg_strncasecmp("aligned", value, vallen) == 0) | 		else if (pg_strncasecmp("aligned", value, vallen) == 0) | ||||||
| 			popt->topt.format = PRINT_ALIGNED; | 			popt->topt.format = PRINT_ALIGNED; | ||||||
| 		else if (pg_strncasecmp("wrapped", value, vallen) == 0) |  | ||||||
| 			popt->topt.format = PRINT_WRAPPED; |  | ||||||
| 		else if (pg_strncasecmp("html", value, vallen) == 0) |  | ||||||
| 			popt->topt.format = PRINT_HTML; |  | ||||||
| 		else if (pg_strncasecmp("asciidoc", value, vallen) == 0) | 		else if (pg_strncasecmp("asciidoc", value, vallen) == 0) | ||||||
| 			popt->topt.format = PRINT_ASCIIDOC; | 			popt->topt.format = PRINT_ASCIIDOC; | ||||||
|  | 		else if (pg_strncasecmp("html", value, vallen) == 0) | ||||||
|  | 			popt->topt.format = PRINT_HTML; | ||||||
| 		else if (pg_strncasecmp("latex", value, vallen) == 0) | 		else if (pg_strncasecmp("latex", value, vallen) == 0) | ||||||
| 			popt->topt.format = PRINT_LATEX; | 			popt->topt.format = PRINT_LATEX; | ||||||
| 		else if (pg_strncasecmp("latex-longtable", value, vallen) == 0) | 		else if (pg_strncasecmp("latex-longtable", value, vallen) == 0) | ||||||
| 			popt->topt.format = PRINT_LATEX_LONGTABLE; | 			popt->topt.format = PRINT_LATEX_LONGTABLE; | ||||||
| 		else if (pg_strncasecmp("troff-ms", value, vallen) == 0) | 		else if (pg_strncasecmp("troff-ms", value, vallen) == 0) | ||||||
| 			popt->topt.format = PRINT_TROFF_MS; | 			popt->topt.format = PRINT_TROFF_MS; | ||||||
|  | 		else if (pg_strncasecmp("unaligned", value, vallen) == 0) | ||||||
|  | 			popt->topt.format = PRINT_UNALIGNED; | ||||||
|  | 		else if (pg_strncasecmp("wrapped", value, vallen) == 0) | ||||||
|  | 			popt->topt.format = PRINT_WRAPPED; | ||||||
| 		else | 		else | ||||||
| 		{ | 		{ | ||||||
| 			psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, asciidoc, latex, latex-longtable, troff-ms\n"); | 			psql_error("\\pset: allowed formats are aligned, asciidoc, html, latex, latex-longtable, troff-ms, unaligned, wrapped\n"); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -3539,9 +3539,9 @@ psql_completion(const char *text, int start, int end) | |||||||
| 	else if (TailMatchesCS("\\pset", MatchAny)) | 	else if (TailMatchesCS("\\pset", MatchAny)) | ||||||
| 	{ | 	{ | ||||||
| 		if (TailMatchesCS("format")) | 		if (TailMatchesCS("format")) | ||||||
| 			COMPLETE_WITH_CS("unaligned", "aligned", "wrapped", "html", | 			COMPLETE_WITH_CS("aligned", "asciidoc", "html", "latex", | ||||||
| 							 "asciidoc", "latex", "latex-longtable", | 							 "latex-longtable", "troff-ms", "unaligned", | ||||||
| 							 "troff-ms"); | 							 "wrapped"); | ||||||
| 		else if (TailMatchesCS("linestyle")) | 		else if (TailMatchesCS("linestyle")) | ||||||
| 			COMPLETE_WITH_CS("ascii", "old-ascii", "unicode"); | 			COMPLETE_WITH_CS("ascii", "old-ascii", "unicode"); | ||||||
| 		else if (TailMatchesCS("pager")) | 		else if (TailMatchesCS("pager")) | ||||||
|  | |||||||
| @ -26,14 +26,14 @@ | |||||||
| enum printFormat | enum printFormat | ||||||
| { | { | ||||||
| 	PRINT_NOTHING = 0,			/* to make sure someone initializes this */ | 	PRINT_NOTHING = 0,			/* to make sure someone initializes this */ | ||||||
| 	PRINT_UNALIGNED, |  | ||||||
| 	PRINT_ALIGNED, | 	PRINT_ALIGNED, | ||||||
| 	PRINT_WRAPPED, |  | ||||||
| 	PRINT_HTML, |  | ||||||
| 	PRINT_ASCIIDOC, | 	PRINT_ASCIIDOC, | ||||||
|  | 	PRINT_HTML, | ||||||
| 	PRINT_LATEX, | 	PRINT_LATEX, | ||||||
| 	PRINT_LATEX_LONGTABLE, | 	PRINT_LATEX_LONGTABLE, | ||||||
| 	PRINT_TROFF_MS | 	PRINT_TROFF_MS, | ||||||
|  | 	PRINT_UNALIGNED, | ||||||
|  | 	PRINT_WRAPPED | ||||||
| 	/* add your favourite output format here ... */ | 	/* add your favourite output format here ... */ | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user