Changeset: 60c1deab34d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=60c1deab34d8
Modified Files:
        clients/ChangeLog
        clients/mapiclient/mclient.c
Branch: default
Log Message:

Added possibility in mclient to use quit or exit on the command-line to quit 
the program.
This makes it easier for novice users not familiar with mclient (or psql) 
special commands to quit the program, if they do not know that the standard 
command to quit is \q.

This enhancement is inspired by psql which has added this possibility in 
release 11, see https://www.postgresql.org/about/news/1855/    section: User 
Experience Enhancements
Excerpt:
"Another feature that fell into this category was the inability to intuitively 
quit from the PostgreSQL command-line (psql). There has been numerous recorded 
complaints of users trying to quit with the quit and exit commands, only to 
learn that the command to do so was \q.
 We have heard your frustrations and have now added the ability to quit the 
command-line using the keywords quit and exit and hope that quitting a 
PostgreSQL session is now as enjoyable as using PostgreSQL."


diffs (44 lines):

diff --git a/clients/ChangeLog b/clients/ChangeLog
--- a/clients/ChangeLog
+++ b/clients/ChangeLog
@@ -1,3 +1,8 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Thu Oct 11 2018 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- The mclient program can now be quit by typing quit or exit on the
+  command-line.  This makes it easier for novice users to quit the program
+  if they do not know that the standard command to quit is \q.
+
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2204,9 +2204,9 @@ showCommands(void)
        mnstr_printf(toConsole, "\\f       - format using renderer 
{csv,tab,raw,sql,xml,trash,rowcount,expanded,sam}\n");
        mnstr_printf(toConsole, "\\w#      - set maximal page width 
(-1=unlimited, 0=terminal width, >0=limit to num)\n");
        mnstr_printf(toConsole, "\\r#      - set maximum rows per page 
(-1=raw)\n");
-       mnstr_printf(toConsole, "\\L file  - save client/server interaction\n");
+       mnstr_printf(toConsole, "\\L file  - save client-server interaction\n");
        mnstr_printf(toConsole, "\\X       - trace mclient code\n");
-       mnstr_printf(toConsole, "\\q       - terminate session\n");
+       mnstr_printf(toConsole, "\\q       - terminate session and quit 
mclient\n");
 }
 
 #define MD_TABLE    1
@@ -2425,6 +2425,16 @@ doFile(Mapi mid, stream *fp, bool useins
                                        line[5] = prepno < 10 ? ' ' : prepno / 
10 + '0';
                                        line[6] = prepno % 10 + '0';
                                }
+                               if (strcmp(line, "exit\n") == 0) {
+                                       free(buf);
+                                       goto bailout;
+                               }
+                               break;
+                       case 'q':
+                               if (strcmp(line, "quit\n") == 0) {
+                                       free(buf);
+                                       goto bailout;
+                               }
                                break;
                        case '\\':
                                switch (line[1]) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to