Changeset 8228
- Timestamp:
- 08/08/08 08:40:11 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/management/__init__.py
r8227 r8228 150 150 pass 151 151 152 def print_help(self): 153 """Output nothing. 154 155 The lax options are included in the normal option parser, so under 156 normal usage, we don't need to print the lax options. 157 """ 158 pass 159 160 def print_lax_help(self): 161 """Output the basic options available to every command. 162 163 This just redirects to the default print_help() behaviour. 164 """ 165 OptionParser.print_help(self) 166 152 167 def _process_args(self, largs, rargs, values): 153 168 """ … … 196 211 Returns the script's main help text, as a string. 197 212 """ 198 usage = ['%s <subcommand> [options] [args]' % self.prog_name] 199 usage.append('Django command line tool, version %s' % django.get_version()) 200 usage.append("Type '%s help <subcommand>' for help on a specific subcommand." % self.prog_name) 213 usage = ['',"Type '%s help <subcommand>' for help on a specific subcommand." % self.prog_name,''] 201 214 usage.append('Available subcommands:') 202 215 commands = get_commands(self.user_commands, self.project_directory).keys() … … 233 246 # These options could affect the commands that are available, so they 234 247 # must be processed early. 235 parser = LaxOptionParser(version=get_version(), option_list=BaseCommand.option_list) 248 parser = LaxOptionParser(usage="%prog subcommand [options] [args]", 249 version=get_version(), 250 option_list=BaseCommand.option_list) 236 251 try: 237 252 options, args = parser.parse_args(self.argv) … … 250 265 self.fetch_command(args[2]).print_help(self.prog_name, args[2]) 251 266 else: 267 parser.print_lax_help() 252 268 sys.stderr.write(self.main_help_text() + '\n') 253 269 sys.exit(1) … … 258 274 pass 259 275 elif self.argv[1:] == ['--help']: 276 parser.print_lax_help() 260 277 sys.stderr.write(self.main_help_text() + '\n') 261 278 else: django/trunk/tests/regressiontests/admin_scripts/tests.py
r8227 r8228 895 895 out, err = self.run_manage(args) 896 896 if sys.version_info < (2, 5): 897 self.assertOutput(out, "usage: manage.py [options]")897 self.assertOutput(out, "usage: manage.py subcommand [options] [args]") 898 898 else: 899 self.assertOutput(out, "Usage: manage.py [options]")899 self.assertOutput(out, "Usage: manage.py subcommand [options] [args]") 900 900 self.assertOutput(err, "Type 'manage.py help <subcommand>' for help on a specific subcommand.") 901 901
