Skip to content

Commit

Permalink
Make copying to clipboard optional and off by default.
Browse files Browse the repository at this point in the history
I don't like that gist automatically wipes out the clipboard, since I frequently pipe from pbpaste to gist and don't want the clipboard wiped out.
  • Loading branch information
headius committed Jul 11, 2011
1 parent 04ffbef commit 94db7fe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gist
Expand Up @@ -110,6 +110,7 @@ module Gist
gist_filename = nil
gist_extension = defaults["extension"]
browse_enabled = defaults["browse"]
copy = defaults["copy"]

opts = OptionParser.new do |opts|
opts.banner = "Usage: gist [options] [filename or stdin] [filename] ...\n" +
Expand Down Expand Up @@ -141,6 +142,10 @@ module Gist
puts opts
exit
end

opts.on('-c', '--[no-]copy', 'Copy gist URL to clipboard automatically') do |c|
copy = c
end
end

opts.parse!(args)
Expand Down Expand Up @@ -170,7 +175,8 @@ module Gist

url = write(files, private_gist)
browse(url) if browse_enabled
puts copy(url)
copy(url) if copy
puts url
rescue => e
warn e
puts opts
Expand Down Expand Up @@ -265,6 +271,7 @@ private
"private" => config("gist.private"),
"browse" => config("gist.browse"),
"extension" => extension,
"copy" => config("gist.copy"),
}
end

Expand Down

0 comments on commit 94db7fe

Please sign in to comment.