Skip to content

Conversation

@thornjad
Copy link
Member

@thornjad thornjad commented Sep 4, 2018

This commit makes a handful of closely-related changes, all aimed at refactoring bin/http-server for better maintainability.

  • Switched from deprecated optimist to the smaller minimist for CLI parsing
  • Used aliases to link together switches with both a - and -- option, thereby removing the need for patterns like argv.g || argv.gzip
  • Set defaults on almost all switches. This can make debugging easier and makes default values more clear
  • Reformatted the help dialog
  • Clarified the help dialog to take a sidestep around Make Boolean command line switches case insensitive #450. As noted in How to disable directory listings? #200 (comment), False is a string, so it should not work on a boolean switch. Instead, this new help dialog encourages using the --no prefix. For example, -i enables autoIndex, and --no-i disables it. This is already possible, so it's not actually an interface change
  • As far as I can tell, this PR introduces no user-facing changes except for the help dialog

Copy link
Member

@BigBlueHat BigBlueHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this! We do need to get off optimist, and minimist seems sufficient with the least amount of code restructuring.

I left a few inline comments which would hopefully help make the usage code a bit clearer.

Appreciate the contribution!
🎩

@BigBlueHat BigBlueHat added the minor version non-breaking, non-trivial change label Nov 14, 2018
@thornjad
Copy link
Member Author

I'm currently working my way through the pile of PRs, and I have to say I like #131 better than this approach. @BigBlueHat @indexzero what do you think about this minimist PR vs nconf? I definitely like the idea of a .httpserverrc.

@thornjad
Copy link
Member Author

I am officially laying this PR down in favor of nconf in #131, it's very well done over there.

@thornjad thornjad closed this Apr 16, 2019
@thornjad thornjad deleted the renovate-cli branch December 19, 2019 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor version non-breaking, non-trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants