Skip to content

Commit 42d99fa

Browse files
committed
Use the code that's already there
1 parent 0981fbb commit 42d99fa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/gist.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def execute(*args)
7171
opts.parse!(args)
7272

7373
begin
74-
if $stdin.tty?
74+
if $stdin.tty? && args[0] != '-'
7575
# Run without stdin.
7676

7777
# No args, print help.
@@ -80,10 +80,8 @@ def execute(*args)
8080
exit
8181
end
8282

83-
if args[0] == '-'
84-
input = $stdin.read
8583
# Check if arg is a file. If so, grab the content.
86-
elsif File.exists?(file = args[0])
84+
if File.exists?(file = args[0])
8785
input = File.read(file)
8886
gist_filename = file
8987
gist_extension = File.extname(file) if file.include?('.')

0 commit comments

Comments
 (0)