millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

Not responding to -h or --help #54

Closed victor73 closed 11 years ago

victor73 commented 11 years ago

When invoked after a pipe, esformatter seems to work fine. However, invoking the help message via -h or --help causes it to hang and the prompt does not return. Installed esformatter via npm install -g esformatter on a RHEL Linux x86_64 machine.

jzaefferer commented 11 years ago

What's the usecase for invoking esformatter, in a pipe, with the help option?

victor73 commented 11 years ago

It's hanging when invoked standalone:

$ esformatter --help

Although, I can see a reason for having the --help work at the end of a pipeline as well. Let's say you invoke esformatter after a particularly long command, and esformatter complains about a bad/invalid invocation. One could simply arrow up and add a --help to get the help message. Minor point there, but --help should work on a standalone invocation as the documentation page shows.

jzaefferer commented 11 years ago

Can you clone the repo and run bin/esformatter --help to see if that also hangs? What node version are you running?

victor73 commented 11 years ago

Currently stuck because of the following sequence:

$ git clone https://github.com/millermedeiros/esformatter Cloning into 'esformatter'... remote: Counting objects: 1062, done. remote: Compressing objects: 100% (595/595), done. remote: Total 1062 (delta 477), reused 984 (delta 412) Receiving objects: 100% (1062/1062), 188.79 KiB, done. Resolving deltas: 100% (477/477), done.

$ cd esformatter $ npm install rocambole npm http GET https://registry.npmjs.org/rocambole npm http 304 https://registry.npmjs.org/rocambole npm http GET https://registry.npmjs.org/esprima npm http 304 https://registry.npmjs.org/esprima rocambole@0.2.3 node_modules/rocambole └── esprima@1.0.3

$ node --version v0.10.15

$ bin/esformatter --help

module.js:340 throw err; ^ Error: Cannot find module 'mout/string/repeat' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/victor/esformatter/lib/util/indent.js:6:14) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)

millermedeiros commented 11 years ago

Run npm install without the "rocambole", that should install all the dependencies.

victor73 commented 11 years ago

Okay, so after installing all the dependencies

$ bin/esformatter --help
Usage:
  esformatter [OPTIONS] <fileName>

Options:
  -c, --config STRING    Custom configuration object
  -v, --version          Display the current version
  -h, --help             Display help and usage details

However, when invoking 'esformatter --help' using a global npm install, it still hangs. Very odd.

$ esformatter --help

millermedeiros commented 11 years ago

What's your OS and node.js version? Maybe it's a bug on the cli module we are using. Do you get any error message?

BTW, I pushed a new version to npm today. Maybe try to uninstall it and install again.

victor73 commented 11 years ago

Was on Ubuntu 13.04 x86_64. Blew away the earlier install:

$ sudo npm uninstall -g esformatter

$ sudo npm install -g esformatter npm http GET https://registry.npmjs.org/mout npm http GET https://registry.npmjs.org/rocambole npm http GET https://registry.npmjs.org/cli npm http 304 https://registry.npmjs.org/cli npm http 304 https://registry.npmjs.org/mout npm http 304 https://registry.npmjs.org/rocambole npm http GET https://registry.npmjs.org/glob npm http GET https://registry.npmjs.org/esprima npm http 304 https://registry.npmjs.org/glob npm http GET https://registry.npmjs.org/glob/-/glob-3.2.6.tgz npm http 304 https://registry.npmjs.org/esprima npm http 200 https://registry.npmjs.org/glob/-/glob-3.2.6.tgz npm http GET https://registry.npmjs.org/minimatch npm http GET https://registry.npmjs.org/inherits npm http 304 https://registry.npmjs.org/minimatch npm http 304 https://registry.npmjs.org/inherits npm http GET https://registry.npmjs.org/inherits/-/inherits-2.0.0.tgz npm http 200 https://registry.npmjs.org/inherits/-/inherits-2.0.0.tgz npm http GET https://registry.npmjs.org/lru-cache npm http GET https://registry.npmjs.org/sigmund npm http 304 https://registry.npmjs.org/lru-cache npm http 304 https://registry.npmjs.org/sigmund /usr/bin/esformatter -> /usr/lib/node_modules/esformatter/bin/esformatter esformatter@0.0.6 /usr/lib/node_modules/esformatter ├── mout@0.5.0 ├── rocambole@0.2.3 (esprima@1.0.3) └── cli@0.4.5 (glob@3.2.6)

And that fixes it !

millermedeiros commented 11 years ago

I'm closing it for now. Maybe later if more people have issues with it I will replace the arguments parser with something else and try to debug it. cheers.