Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaner module.exports #7

Open
thetrompf opened this issue Jul 8, 2014 · 2 comments
Open

Cleaner module.exports #7

thetrompf opened this issue Jul 8, 2014 · 2 comments

Comments

@thetrompf
Copy link

In docopt.coffee you use

module.exports =
  docopt: docopt
  ...   : ...

And that is all great but your list is now very long, and you have long names in it too, which makes it a problem to align, because you will have to change "all" the lines in module.exports = {} just because a longer name comes along.

Coffeescript have a nice way to create object hashes when the key names are equal to the variable names:

module.exports = {
    docopt
    Option
    Argument
    Command
    Required
    AnyOptions
    Either
    Optional
    Pattern
    OneOrMore
    TokenStream
    Dict
    formal_usage
    parse_doc_options
    parse_pattern
    parse_long
    parse_shorts
    parse_args
    printable_usage
}

This way you don't need anything to align, and it is easy to add new key/value pairs with out change any other lines in the object hash.

@keleshev
Copy link
Member

@sonwell, are you still maintaining this project?

@sonwell
Copy link
Contributor

sonwell commented Jul 15, 2014

I don't really have the time to.

In any case, I think eventually module.exports will be pretty simple. All of the classes, functions, etc. are exposed for testing.

kemitchell pushed a commit to kemitchell/docopt.coffee that referenced this issue Jul 1, 2017
improve build process as preparation for further pull requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants