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

add --skip-empty to skip gisting empty files #270

Merged
merged 2 commits into from
Oct 9, 2017

Conversation

phallstrom
Copy link

@phallstrom phallstrom commented Oct 7, 2017

fixes #208

Option --skip-empty will skip any zero length files passes to gist. If
all files are empty no gist will be created at all.

test plan:

  - create two empty files 'empty1' and 'empty2'.
  - create a third file with some content 'content1'.

  % bin/gist empty1 empty2 content1
  # should return error about an empty file

  % bin/gist --skip-empty empty1 empty2 content1
  # should create gist with single file 'content1'

  % bin/gist --skip-empty empty1 empty2
  # should return error/notice about all files empty no gist created

  % date | bin/gist
  # should create gist with date string

fixes defunkt#208

Option --skip-empty will skip any zero length files passes to gist. If
all files are empty no gist will be created at all.

test plan:
  - create two empty files 'empty1' and 'empty2'.
  - create a third file with some content 'content1'.

  % bin/gist empty1 empty2 content1
  # should return error about an empty file

  % bin/gist --skip-empty empty1 empty2 content1
  # should create gist with single file 'content1'

  % bin/gist --skip-empty empty1 empty2
  # should return error/notice about all files empty no gist created

  % date | bin/gist
  # should create gist with date string
lib/gist.rb Outdated
end

raise "All files were empty. No gist created." if json[:files].empty? && options[:skip_empty]
Copy link
Collaborator

Choose a reason for hiding this comment

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

@phallstrom I think the program should not crash if you pass --skip-empty and an empty file. It should just silently exit successfully.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, I misread the original ticket thinking you wanted it to output details. Patch up.

@ConradIrwin
Copy link
Collaborator

Otherwise this looks good to me, thank you!

@ConradIrwin
Copy link
Collaborator

Thanks @phallstrom!

@ConradIrwin ConradIrwin merged commit c817380 into defunkt:master Oct 9, 2017
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.

Option to skip empty files
2 participants