Giter Site home page Giter Site logo

Comments (7)

hedgehog avatar hedgehog commented on August 18, 2024

ideally would be sorted, a-z, by the long-form option name;

from thor.

josevalim avatar josevalim commented on August 18, 2024

At first we had an ordered hash implementation to keep the order of the options as they are added, but it was adding a lot of implementation issues. So we just use a Hash, because they will be ordered in 1.9 (and possibly in 1.8.8).

from thor.

hedgehog avatar hedgehog commented on August 18, 2024

this is a biggie when you are writting a cli script - I really need to know what my user help text looks like. No idea what the oerdered hash issues were - ignorance is bliss :)
I'm not sure an ordered hash would scratch the itch... with many options users will appreciate/want a sorted list, so maybe allow the script author to pass a help option: sorted => true ?

from thor.

josevalim avatar josevalim commented on August 18, 2024

It should be a class configuration option, something along this line:

class App < Thor
sort_options_alphabetically!
end

If you provide a patch, I will merge it. But, sorry, I won't merge your whole stack because having test code in lib/thor.rb looks like a smell to me.

from thor.

hedgehog avatar hedgehog commented on August 18, 2024

I had in mind :ordered_help => true/false in the options hash of:
desc()
method_option()

Not sure what other methods it could be passed to....
Default is true and Capitalized option names are given priority.
Behavior would be the ordered_help would appear above the unordered help, and would respect groupings.
But as you've noticed I'm new to Thor so this might not be feasible given the time.

from thor.

josevalim avatar josevalim commented on August 18, 2024

The default should be the order you declare. You can always declare alphabetically. Github does not allow to reopen issues, so please do when you have a patch.

from thor.

hedgehog avatar hedgehog commented on August 18, 2024

Good point, the name is ambiguous. sorted_help is the accurate option name.

from thor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.