Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[Patch] Improve readability of `script/generate` (without args)

#3705

The current output of script/generate without any args isn't particularly readable (ie its hard to find the generator you want), and doesn't display usage (like script/generate scaffold does, for example):

$ script/generate 
Please select a generator.
Builtin: active_record:migration, active_record:model, active_record:observer, active_record:session_migration, app, controller, erb:controller, erb:mailer, erb:scaffold, generator, helper, integration_test, mailer, metal, migration, model, model_subclass, observer, performance_test, plugin, resource, scaffold, scaffold_controller, session_migration, stylesheets, test_unit:controller, test_unit:helper, test_unit:integration, test_unit:mailer, test_unit:model, test_unit:observer, test_unit:performance, test_unit:plugin, test_unit:scaffold.

If I were to suggest something, I'd go for more like:

$ script/generate 
Usage
  script/generate [generator] [generate-specific options]
 
Builtin Generators:
    active_record:migration
    active_record:model
    active_record:observer
    active_record:session_migration
    app
    controller
    erb:controller
    erb:mailer
    erb:scaffold
    generator
    helper
    integration_test
    mailer
    metal
    migration
    model
    model_subclass
    observer
    performance_test
    plugin
    resource
    scaffold
    scaffold_controller
    session_migration
    stylesheets
    test_unit:controller
    test_unit:helper
    test_unit:integration
    test_unit:mailer
    test_unit:model
    test_unit:observer
    test_unit:performance
    test_unit:plugin
    test_unit:scaffold

It is certainly more lines of output, but, it's a lot easier to grep/less/scroll to find what you're looking for.

Reported by Josh Nichols · January 16th, 2010 @ 04:38 AM

State: resolved
Milestone: none
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. Josh Nichols
    Josh Nichols
    • Tag changed from rails3, rails_generator to bugmash, rails3, rails_generator

    January 16th, 2010 @ 05:39 AM

  2. Rizwan Reza
    Rizwan Reza

    +1

    The patch for the above output is attached. I've tested again by reapplying it to master. It applies cleanly.

    January 16th, 2010 @ 08:04 AM

  3. Ravil Bayramgalin
    Ravil Bayramgalin

    +1 I've attached a patch which fixes grammar mistake in previous one, adds correct whitespace offset for generator names and updates a failing test.

    January 16th, 2010 @ 08:12 AM

  4. Prem Sichanugrist (sikachu)
  5. Rizwan Reza
    Rizwan Reza
    • Title changed from imrove readability of `script/generate` (without args) to [Patch] Improve readability of `script/generate` (without args)

    January 16th, 2010 @ 03:51 PM

  6. José Valim
    José Valim
    • State changed from new to open
    • Assigned user set to José Valim

    January 16th, 2010 @ 04:05 PM

  7. José Valim
    José Valim
    • State changed from open to resolved

    January 18th, 2010 @ 03:32 PM