← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: Looking for feedback - Short options for MySQL Proxy

 

Hi!

On Feb 28, 2009, at 12:22 PM, Jan Kneschke wrote:

Diego Medina wrote:
Hi everyone,

I decided to start working on this blueprint:

Chassis/Proxy should have short names for often used options
https://blueprints.launchpad.net/mysql-proxy/+spec/chassis-short-option-names


and I'm looking for some feedback. I think that we should have short
options being two/three letters, instead of only one.

The problem with this is that it's counterintuitive. A single '-' is only used with a single letter (this always throws me off when using java, for example...).

This is so that we can append one letter for the plugin name, and then
another letter for the actual option.

As we want to stay with glibs GOption* functions we are limited to one
character only.

http://library.gnome.org/devel/glib/stable/glib-Commandline-option-parser.html

I would love to continue to just use the GOption* functions, but I have at least three problems with them: - since our long option names are truly _long_, command lines are uncomfortably verbose - the --help* output is incredibly wide (non-issue for me personally since I use _really_ wide terminals - still a nuisance) - passing multiple entries for array valued options forces you to repeat the option and the relevant options are _looooong_

The last point is somewhat mitigated by the fact that you can use key- value files, but it would be nice to simply give an option a comma or otherwise separated list (and not lose glib support while doing it). From a passing glance over the goption docs, we probably could hack support for this in by using a post-parse hook function, though.

In reality, most of the options that we care about are from the proxy plugin, so we should probably start assigning short options to that, while keeping in mind the list Jan assembled below. I'm not so much surprised that our overlap with the server is small, since we really need a wildly different set of options to operate.

Unfortunately the g_option_context_parse function is largely monolithic and we can't easily take the option parsing portion of it and say just switch out the help rendering code (it's a static function in that file). I'd hate to recreate all that code just for parsing options and then displaying a help, but that's what it looks like to me right now :(

cheers,
-k

These are my ideas:

(the ones with no short options are the ones _I_ think are not common,
but if you think this is not the case, please let me know :)

We may want to check what the mysql-server uses as short-names. Keeping
the short-options with the same meaning makes their use a no-brainer.

$ mysqld --verbose --help | grep ' -[^-]'
-a, --ansi Use ANSI SQL syntax instead of MySQL syntax. This mode -b, --basedir=name Path to installation directory. All paths are usually
 -C, --character-set-server=name
 -r, --chroot=name   Chroot mysqld daemon during startup.
 -h, --datadir=name  Path to the database root.
 -C, --default-character-set=name
 -T, --exit-info[=#] Used for debugging;  Use at your own risk!
 -?, --help          Display this help and exit.
 -L, --language=name Client error messages in given language. m
 -l, --log[=name]    Log connections and queries to file.
 -0, --log-long-format
 -W, --log-warnings[=#]
 -n, --new           Use very new possible 'unsafe' functions.
-P, --port=# Port number to use for connection or 0 for default
 -O, --set-variable=name
 -s, --symbolic-links
 -t, --tmpdir=name   Path for temporary files.
 -s, --use-symbolic-links
 -u, --user=name     Run mysqld daemon as user.
 -v, --verbose       Used with --help option for detailed help
 -V, --version       Output version information and exit.
 -W, --warnings[=#]  Deprecated; use --log-warnings instead.

From that list we can use:
 -u, --user=
 -P could make to --proxy-address=
 -? is already there
 -V too
 -b, --basedir=
 -W could perhaps we mapped to --log-level=...

Hmm, I assumed that list would be longer.

cheers,
 Jan
--
jan: "Gee, Brain^WEric, what'd you wanna do tonight?"
eric: Same thing we do everynight: Take over the HelloWorld!

_______________________________________________
Mailing list: https://launchpad.net/~mysql-proxy-discuss
Post to     : mysql-proxy-discuss@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~mysql-proxy-discuss
More help   : https://help.launchpad.net/ListHelp

--
Kay Roepke
Software Engineer, MySQL Enterprise Tools

Sun Microsystems GmbH    Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering                    HRB MUC 161028




Follow ups

References