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

modified cli.js so that it can read from piped input by default #558

Closed
wants to merge 1 commit into from

Conversation

ben-bradley
Copy link

I modified cli.js so that it expects stdin by default if no arguments are provided and will detect when no stdin is provided:

  • stdin piping before:
$ cat package.json | js-beautify -f -
{{ pretty output }}
$ cat package.json | js-beautify
Must define at least one file.
Run `js-beautify.js -h` for help.
  • stdin piping after:
$ cat package.json | js-beautify -f -
{{ pretty output }}
$ cat package.json | js-beautify
{{ pretty output }}
  • before with no stdin:
$ js-beautify -f -
{{ hangs until ctrl+c }}
$ js-beautify
Must define at least one file.
Run `js-beautify.js -h` for help.
  • after with no stdin:
$ js-beautify -f -
No input detected
Run `js-beautify.js -h` for help.
$ js-beautify
No input detected
Run `js-beautify.js -h` for help.

@bitwiseman
Copy link
Member

Interesting. Please update the python and the tests too.

@ben-bradley
Copy link
Author

@bitwiseman I'd love to, but I have no experience with the test framework in this project or Python and I'm afraid I'd do more harm modifying that piece of code.

@bitwiseman
Copy link
Member

That's unfortunate. This looks like a good change. In any case, it is an api change, so it will have to wait both until the next version and I have time to look at porting it to python and fixing the tests. \

Thanks for starting point!

@bitwiseman bitwiseman added this to the v1.6.0 milestone Jan 15, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
bitwiseman added a commit to bitwiseman/js-beautify that referenced this pull request Jan 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants