Mercurial > p > roundup > code
comparison roundup-admin @ 372:3b9410cb8b61
Expanded the already-abbreviated "initialise" and "specification" commands...
...and added a comment to the command help about the abbreviation.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 08 Nov 2001 04:42:00 +0000 |
| parents | f348aa576d51 |
| children | c6d6ea15068b |
comparison
equal
deleted
inserted
replaced
| 371:f348aa576d51 | 372:3b9410cb8b61 |
|---|---|
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 19 # $Id: roundup-admin,v 1.39 2001-11-08 04:29:59 richard Exp $ | 19 # $Id: roundup-admin,v 1.40 2001-11-08 04:42:00 richard Exp $ |
| 20 | 20 |
| 21 import sys | 21 import sys |
| 22 if int(sys.version[0]) < 2: | 22 if int(sys.version[0]) < 2: |
| 23 print 'Roundup requires python 2.0 or later.' | 23 print 'Roundup requires python 2.0 or later.' |
| 24 sys.exit(1) | 24 sys.exit(1) |
| 36 | 36 |
| 37 Original code submitted by Engelbert Gruber. | 37 Original code submitted by Engelbert Gruber. |
| 38 ''' | 38 ''' |
| 39 _marker = [] | 39 _marker = [] |
| 40 def get(self, key, default=_marker): | 40 def get(self, key, default=_marker): |
| 41 d = self.data.get(key, default) | 41 if self.data.has_key(key): |
| 42 if d is not default: return [(key, d)] | 42 return [(key, self.data[key])] |
| 43 keylist = self.data.keys() | 43 keylist = self.data.keys() |
| 44 keylist.sort() | 44 keylist.sort() |
| 45 l = [] | 45 l = [] |
| 46 for ki in keylist: | 46 for ki in keylist: |
| 47 if ki.startswith(key): | 47 if ki.startswith(key): |
| 80 def help_commands(self): | 80 def help_commands(self): |
| 81 print 'Commands:', | 81 print 'Commands:', |
| 82 commands = [''] | 82 commands = [''] |
| 83 for command in self.commands.values(): | 83 for command in self.commands.values(): |
| 84 h = command.__doc__.split('\n')[0] | 84 h = command.__doc__.split('\n')[0] |
| 85 commands.append(h[7:]) | 85 commands.append(' '+h[7:]) |
| 86 commands.sort() | 86 commands.sort() |
| 87 print '\n '.join(commands) | 87 commands.append( |
| 88 'Commands may be abbreviated as long as the abbreviation matches only one') | |
| 89 commands.append('command, e.g. l == li == lis == list.') | |
| 90 print '\n'.join(commands) | |
| 91 print | |
| 88 | 92 |
| 89 def help_all(self): | 93 def help_all(self): |
| 90 print ''' | 94 print ''' |
| 91 All commands (except help) require an instance specifier. This is just the path | 95 All commands (except help) require an instance specifier. This is just the path |
| 92 to the roundup instance you're working with. A roundup instance is where | 96 to the roundup instance you're working with. A roundup instance is where |
| 183 import roundup.backends | 187 import roundup.backends |
| 184 backends = roundup.backends.__all__ | 188 backends = roundup.backends.__all__ |
| 185 print 'Back ends:', ', '.join(backends) | 189 print 'Back ends:', ', '.join(backends) |
| 186 | 190 |
| 187 | 191 |
| 188 def do_init(self, instance_home, args): | 192 def do_initialise(self, instance_home, args): |
| 189 '''Usage: init [template [backend [admin password]]] | 193 '''Usage: initialise [template [backend [admin password]]] |
| 190 Initialise a new Roundup instance. | 194 Initialise a new Roundup instance. |
| 191 | 195 |
| 192 The command will prompt for the instance home directory (if not supplied | 196 The command will prompt for the instance home directory (if not supplied |
| 193 through INSTANCE_HOME or the -i option. The template, backend and admin | 197 through INSTANCE_HOME or the -i option. The template, backend and admin |
| 194 password may be specified on the command-line as arguments, in that | 198 password may be specified on the command-line as arguments, in that |
| 317 print ','.join(cl.find(**{propname: value})) | 321 print ','.join(cl.find(**{propname: value})) |
| 318 else: | 322 else: |
| 319 print cl.find(**{propname: value}) | 323 print cl.find(**{propname: value}) |
| 320 return 0 | 324 return 0 |
| 321 | 325 |
| 322 def do_spec(self, args): | 326 def do_specification(self, args): |
| 323 '''Usage: spec classname | 327 '''Usage: specification classname |
| 324 Show the properties for a classname. | 328 Show the properties for a classname. |
| 325 | 329 |
| 326 This lists the properties for a given class. | 330 This lists the properties for a given class. |
| 327 ''' | 331 ''' |
| 328 classname = args[0] | 332 classname = args[0] |
| 719 tool = AdminTool() | 723 tool = AdminTool() |
| 720 sys.exit(tool.main()) | 724 sys.exit(tool.main()) |
| 721 | 725 |
| 722 # | 726 # |
| 723 # $Log: not supported by cvs2svn $ | 727 # $Log: not supported by cvs2svn $ |
| 728 # Revision 1.39 2001/11/08 04:29:59 richard | |
| 729 # roundup-admin now accepts abbreviated commands (eg. l = li = lis = list) | |
| 730 # [thanks Engelbert Gruber for the inspiration] | |
| 731 # | |
| 724 # Revision 1.38 2001/11/05 23:45:40 richard | 732 # Revision 1.38 2001/11/05 23:45:40 richard |
| 725 # Fixed newuser_action so it sets the cookie with the unencrypted password. | 733 # Fixed newuser_action so it sets the cookie with the unencrypted password. |
| 726 # Also made it present nicer error messages (not tracebacks). | 734 # Also made it present nicer error messages (not tracebacks). |
| 727 # | 735 # |
| 728 # Revision 1.37 2001/10/23 01:00:18 richard | 736 # Revision 1.37 2001/10/23 01:00:18 richard |
