Mercurial > vixm
diff vixm/ui.py @ 20:f39963e96ca1
Rework of the help string code
Instead of having all the help strings in the command table, we just shove
them into the __doc__ for each of the function handlers. This means that no
one function can handle two different functionalities as their help string
space would collide. This is fine most of the time anyway. However, the
considerably cleaner command table is a major plus.
The only other "negative" side-effect is the fact that we need to make sure
that the first two lines of the function handler are in the right format.
First line: the command along with any optional or mandatory arguments
Second line: "\t - " followed by a one line description of what the command
does.
Subsequent lines: All subsequent lines are currently ignored, however it
would be nice to display the entire __doc__ string content when something
like "h <help string>"-type functionality is implemented.
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 20 Aug 2006 01:00:29 -0400 |
parents | a3385f616b53 |
children | dfcf1a46fc56 |
line wrap: on
line diff
--- a/vixm/ui.py Sun Aug 20 00:31:33 2006 -0400 +++ b/vixm/ui.py Sun Aug 20 01:00:29 2006 -0400 @@ -110,65 +110,44 @@ self.cmdtable = { "q([!]){,1}": (control.cmd_quit, - False, - "q[!]", - "quit"), - "n( ([0-9]+)){,1}": + False), + "n( *([0-9]+)){,1}": (control.cmd_number, - True, - "[range]n [playlistid]", - "numbered display of lines in range in playlistid"), - "l( ([0-9]+)){,1}": + True), + "l( *([0-9]+)){,1}": (control.cmd_list, - True, - "[range]l [playlistid]", - "list lines in range in playlistid"), - "a ([0-9]+)": + True), + "a *([0-9]+)": (control.cmd_enqueue, - False, - "a [songid]", - "add songid from default to priority"), + False), "d": (control.cmd_dequeue, - True, - "[range]d", - "remove songs in range from priority"), + True), "h": (control.cmd_help, - False, - "h", - "this help list"), + False), # the following commands are there do allow some, # more direct control over xmms "z": (control.cmd_prev, - "z", - "previous item in playlist"), + False), "x": (control.cmd_play, - False, - "x", - "play"), + False), "c": (control.cmd_pause, - False, - "c", - "pause"), + False), "v": (control.cmd_stop, - False, - "v", - "stop"), + False), "b": (control.cmd_next, - False, - "b", - "next item in playlist"), + False), + # the following commands are there to make the + # experience more like ed/ex/vi/vim "!(.*)": (control.cmd_shell, - False, - "![cmd]", - "execute a shell command"), + False), } def __cmd(self, txt):