* slashUsage * * print out help for the backslash commands */
| 155 | * print out help for the backslash commands |
| 156 | */ |
| 157 | void |
| 158 | slashUsage(unsigned short int pager) |
| 159 | { |
| 160 | FILE *output; |
| 161 | char *currdb; |
| 162 | |
| 163 | currdb = PQdb(pset.db); |
| 164 | if (currdb == NULL) |
| 165 | currdb = ""; |
| 166 | |
| 167 | /* |
| 168 | * Keep this line count in sync with the number of lines printed below! |
| 169 | * Use "psql --help=commands | wc" to count correctly. It's okay to count |
| 170 | * the USE_READLINE line even in builds without that. |
| 171 | */ |
| 172 | output = PageOutput(136, pager ? &(pset.popt.topt) : NULL); |
| 173 | |
| 174 | fprintf(output, _("General\n")); |
| 175 | fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n")); |
| 176 | fprintf(output, _(" \\crosstabview [COLUMNS] execute query and display results in crosstab\n")); |
| 177 | fprintf(output, _(" \\errverbose show most recent error message at maximum verbosity\n")); |
| 178 | fprintf(output, _(" \\g [(OPTIONS)] [FILE] execute query (and send results to file or |pipe);\n" |
| 179 | " \\g with no arguments is equivalent to a semicolon\n")); |
| 180 | fprintf(output, _(" \\gdesc describe result of query, without executing it\n")); |
| 181 | fprintf(output, _(" \\gexec execute query, then execute each value in its result\n")); |
| 182 | fprintf(output, _(" \\gset [PREFIX] execute query and store results in psql variables\n")); |
| 183 | fprintf(output, _(" \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n")); |
| 184 | fprintf(output, _(" \\q quit psql\n")); |
| 185 | fprintf(output, _(" \\watch [SEC] execute query every SEC seconds\n")); |
| 186 | fprintf(output, "\n"); |
| 187 | |
| 188 | fprintf(output, _("Help\n")); |
| 189 | |
| 190 | fprintf(output, _(" \\? [commands] show help on backslash commands\n")); |
| 191 | fprintf(output, _(" \\? options show help on psql command-line options\n")); |
| 192 | fprintf(output, _(" \\? variables show help on special variables\n")); |
| 193 | fprintf(output, _(" \\h [NAME] help on syntax of SQL commands, * for all commands\n")); |
| 194 | fprintf(output, "\n"); |
| 195 | |
| 196 | fprintf(output, _("Query Buffer\n")); |
| 197 | fprintf(output, _(" \\e [FILE] [LINE] edit the query buffer (or file) with external editor\n")); |
| 198 | fprintf(output, _(" \\ef [FUNCNAME [LINE]] edit function definition with external editor\n")); |
| 199 | fprintf(output, _(" \\ev [VIEWNAME [LINE]] edit view definition with external editor\n")); |
| 200 | fprintf(output, _(" \\p show the contents of the query buffer\n")); |
| 201 | fprintf(output, _(" \\r reset (clear) the query buffer\n")); |
| 202 | #ifdef USE_READLINE |
| 203 | fprintf(output, _(" \\s [FILE] display history or save it to file\n")); |
| 204 | #endif |
| 205 | fprintf(output, _(" \\w FILE write query buffer to file\n")); |
| 206 | fprintf(output, "\n"); |
| 207 | |
| 208 | fprintf(output, _("Input/Output\n")); |
| 209 | fprintf(output, _(" \\copy ... perform SQL COPY with data stream to the client host\n")); |
| 210 | fprintf(output, _(" \\echo [-n] [STRING] write string to standard output (-n for no newline)\n")); |
| 211 | fprintf(output, _(" \\i FILE execute commands from file\n")); |
| 212 | fprintf(output, _(" \\ir FILE as \\i, but relative to location of current script\n")); |
| 213 | fprintf(output, _(" \\o [FILE] send all query results to file or |pipe\n")); |
| 214 | fprintf(output, _(" \\qecho [-n] [STRING] write string to \\o output stream (-n for no newline)\n")); |
no test coverage detected