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

Automatically create a file or smartly send the data to stdout when piped #36

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

caribpa
Copy link

@caribpa caribpa commented Dec 26, 2021

Hi there!

I've been using this little tool lately and I wanted to contribute with some user-friendly improvements:

  • Automatically create a file named after the URL/file-path (closes Add --output-auto flag #35) by default
  • Or smartly send the data to stdout if the output is being piped
  • Force the output to stdout with --output - following the POSIX conventions (guideline 13)
  • Add some error handling and show concise error messages

In a nutshell:

$ capture-website https://github.com/git               # Auto-creates github.com-git.png in current dir

$ capture-website https://goo.gl | open -f -a Preview  # Automatically pipes the data

$ echo "<h1>Unicorn</h1>" | capture-website            # Auto-creates stdin.png

$ capture-website /path/to/file.html --type=jpeg       # Auto-creates file.jpeg

$ capture-website file:///path/to/file.html            # Auto-creates path-to-file.html.png

$ capture-website file.html --output test.png          # Auto-creates test.png

$ capture-website file.html --output=-                 # Send the data to stdout

$ capture-website http://i.dont/exist                  # Gracefully exits with an error message

Let me know what you think 😊

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

Successfully merging this pull request may close these issues.

Add --output-auto flag
1 participant