gist 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2008 Chris Wanstrath
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ Gist: The Script
2
+ ================
3
+
4
+ Works great with Gist: The Website.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ RubyGem:
10
+
11
+ gem install gist
12
+
13
+ Old school:
14
+
15
+ curl -s http://github.com/defunkt/gist/raw/master/gist > gist &&
16
+ chmod 755 gist &&
17
+ mv gist /usr/local/bin/gist
18
+
19
+ Use
20
+ ---
21
+
22
+ gist < file.txt
23
+ echo secret | gist --private # or -p
24
+ echo "puts :hi" | gist -t rb
25
+ gist script.py
26
+
27
+ Authentication
28
+ --------------
29
+
30
+ Just have your git config set up with your GitHub username and token.
31
+
32
+ git config --global github.user "your-github-username"
33
+ git config --global github.token "your-github-token"
34
+
35
+ You can find your token under [your account](https://github.com/account).
36
+
37
+
38
+ Proxies
39
+ -------
40
+
41
+ Set the HTTP_PROXY env variable to use a proxy.
42
+
43
+ $ HTTP_PROXY=host:port gist file.rb
44
+
45
+ Ninja vs Shark
46
+ --------------
47
+
48
+ ![Ninja vs Shark](http://github.com/defunkt/gist/tree/master%2Fbattle.png?raw=true)
@@ -0,0 +1,47 @@
1
+ require "mg"
2
+ MG.new("gist.gemspec")
3
+
4
+ desc "Build standalone script and manpages"
5
+ task :build => [ :standalone, :build_man ]
6
+
7
+ desc "Build standalone script"
8
+ task :standalone => :load_gist do
9
+ require 'gist/standalone'
10
+ Gist::Standalone.save('gist')
11
+ end
12
+
13
+ desc "Build gist manual"
14
+ task :build_man do
15
+ sh "ron -br5 --organization=GITHUB --manual='Gist Manual' man/*.ron"
16
+ end
17
+
18
+ desc "Show gist manual"
19
+ task :man => :build_man do
20
+ exec "man man/gist.1"
21
+ end
22
+
23
+ task :load_gist do
24
+ $LOAD_PATH.unshift 'lib'
25
+ require 'gist'
26
+ end
27
+
28
+ Rake::TaskManager.class_eval do
29
+ def remove_task(task_name)
30
+ @tasks.delete(task_name.to_s)
31
+ end
32
+ end
33
+
34
+ # Remove mg's install task
35
+ Rake.application.remove_task(:install)
36
+
37
+ desc "Install standalone script and man pages"
38
+ task :install => :standalone do
39
+ prefix = ENV['PREFIX'] || ENV['prefix'] || '/usr/local'
40
+
41
+ FileUtils.mkdir_p "#{prefix}/bin"
42
+ FileUtils.cp "gist", "#{prefix}/bin"
43
+
44
+ FileUtils.mkdir_p "#{prefix}/share/man/man1"
45
+ FileUtils.cp "man/gist.1", "#{prefix}/share/man/man1"
46
+ end
47
+
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # = gist(1)
4
+ #
5
+ # == USAGE
6
+ # gist < file.txt
7
+ # echo secret | gist -p # or --private
8
+ # echo "puts :hi" | gist -t rb
9
+ # gist script.py
10
+ #
11
+ # == INSTALL
12
+ # RubyGem:
13
+ # gem install gist
14
+ # Old school:
15
+ # curl -s http://github.com/defunkt/gist/raw/master/gist > gist &&
16
+ # chmod 755 gist &&
17
+ # mv gist /usr/local/bin/gist
18
+
19
+ require 'gist'
20
+ Gist.execute(*ARGV)
@@ -0,0 +1,154 @@
1
+ require 'open-uri'
2
+ require 'net/http'
3
+ require 'optparse'
4
+
5
+ require 'gist/manpage' unless defined?(Gist::Manpage)
6
+ require 'gist/version' unless defined?(Gist::Version)
7
+
8
+ # You can use this class from other scripts with the greatest of
9
+ # ease.
10
+ #
11
+ # >> Gist.read(gist_id)
12
+ # Returns the body of gist_id as a string.
13
+ #
14
+ # >> Gist.write(content)
15
+ # Creates a gist from the string `content`. Returns the URL of the
16
+ # new gist.
17
+ #
18
+ # >> Gist.copy(string)
19
+ # Copies string to the clipboard.
20
+ #
21
+ # >> Gist.browse(url)
22
+ # Opens URL in your default browser.
23
+ module Gist
24
+ extend self
25
+
26
+ GIST_URL = 'http://gist.github.com/%s.txt'
27
+ CREATE_URL = 'http://gist.github.com/gists'
28
+
29
+ PROXY = ENV['HTTP_PROXY'] ? URI(ENV['HTTP_PROXY']) : nil
30
+ PROXY_HOST = PROXY ? PROXY.host : nil
31
+ PROXY_PORT = PROXY ? PROXY.port : nil
32
+
33
+ # Parses command line arguments and does what needs to be done.
34
+ def execute(*args)
35
+ private_gist = false
36
+ gist_extension = nil
37
+
38
+ opts = OptionParser.new do |opts|
39
+ opts.banner = "Usage: gist [options] [filename or stdin]"
40
+
41
+ opts.on('-p', '--private', 'Make the gist private') do
42
+ private_gist = true
43
+ end
44
+
45
+ t_desc = 'Set syntax highlighting of the Gist by file extension'
46
+ opts.on('-t', '--type [EXTENSION]', t_desc) do |extension|
47
+ gist_extension = '.' + extension
48
+ end
49
+
50
+ opts.on('-m', '--man', 'Print manual') do
51
+ Gist::Manpage.display("gist")
52
+ end
53
+
54
+ opts.on('-h', '--help', 'Display this screen') do
55
+ puts opts
56
+ exit
57
+ end
58
+ end
59
+
60
+ opts.parse!(args)
61
+
62
+ begin
63
+ if $stdin.tty?
64
+ # Run without stdin.
65
+
66
+ # No args, print help.
67
+ if args.empty?
68
+ puts opts
69
+ exit
70
+ end
71
+
72
+ # Check if arg is a file. If so, grab the content.
73
+ if File.exists?(file = args[0])
74
+ input = File.read(file)
75
+ gist_extension = File.extname(file) if file.include?('.')
76
+ else
77
+ abort "Can't find #{file}"
78
+ end
79
+ else
80
+ # Read from standard input.
81
+ input = $stdin.read
82
+ end
83
+
84
+ url = write(input, private_gist, gist_extension)
85
+ browse(url)
86
+ puts copy(url)
87
+ rescue => e
88
+ warn e
89
+ puts opts
90
+ end
91
+ end
92
+
93
+ # Create a gist on gist.github.com
94
+ def write(content, private_gist = false, gist_extension = nil)
95
+ url = URI.parse(CREATE_URL)
96
+
97
+ # Net::HTTP::Proxy returns Net::HTTP if PROXY_HOST is nil
98
+ proxy = Net::HTTP::Proxy(PROXY_HOST, PROXY_PORT)
99
+ req = proxy.post_form(url, data(nil, gist_extension, content, private_gist))
100
+
101
+ req['Location']
102
+ end
103
+
104
+ # Given a gist id, returns its content.
105
+ def read(gist_id)
106
+ open(GIST_URL % gist_id).read
107
+ end
108
+
109
+ # Given a url, tries to open it in your browser.
110
+ # TODO: Linux, Windows
111
+ def browse(url)
112
+ if RUBY_PLATFORM =~ /darwin/
113
+ `open #{url}`
114
+ end
115
+ end
116
+
117
+ # Tries to copy passed content to the clipboard.
118
+ def copy(content)
119
+ cmd = case true
120
+ when system("which pbcopy > /dev/null")
121
+ :pbcopy
122
+ when system("which xclip > /dev/null")
123
+ :xclip
124
+ when system("which putclip")
125
+ :putclip
126
+ end
127
+
128
+ if cmd
129
+ IO.popen(cmd.to_s, 'r+') { |clip| clip.print content }
130
+ end
131
+
132
+ content
133
+ end
134
+
135
+ private
136
+ # Give a file name, extension, content, and private boolean, returns
137
+ # an appropriate payload for POSTing to gist.github.com
138
+ def data(name, ext, content, private_gist)
139
+ return {
140
+ 'file_ext[gistfile1]' => ext,
141
+ 'file_name[gistfile1]' => name,
142
+ 'file_contents[gistfile1]' => content
143
+ }.merge(private_gist ? { 'action_button' => 'private' } : {}).merge(auth)
144
+ end
145
+
146
+ # Returns a hash of the user's GitHub credentials if see.
147
+ # http://github.com/guides/local-github-config
148
+ def auth
149
+ user = `git config --global github.user`.strip
150
+ token = `git config --global github.token`.strip
151
+
152
+ user.empty? ? {} : { :login => user, :token => token }
153
+ end
154
+ end
@@ -0,0 +1,90 @@
1
+ module Gist
2
+ module Manpage
3
+ extend self
4
+
5
+ # Prints a manpage, all pretty and paged.
6
+ def display(name)
7
+ puts manpage(name)
8
+ end
9
+
10
+ # Returns the terminal-formatted manpage, ready to be printed to
11
+ # the screen.
12
+ def manpage(name)
13
+ return "** Can't find groff(1)" unless groff?
14
+
15
+ require 'open3'
16
+ out = nil
17
+ Open3.popen3(groff_command) do |stdin, stdout, _|
18
+ stdin.puts raw_manpage(name)
19
+ stdin.close
20
+ out = stdout.read.strip
21
+ end
22
+ out
23
+ end
24
+
25
+ # Returns the raw manpage. If we're not running in standalone
26
+ # mode, it's a file sitting at the root under the `man`
27
+ # directory.
28
+ #
29
+ # If we are running in standalone mode the manpage will be
30
+ # included after the __END__ of the file so we can grab it using
31
+ # DATA.
32
+ def raw_manpage(name)
33
+ if File.exists? file = File.dirname(__FILE__) + "/../../man/#{name}.1"
34
+ File.read(file)
35
+ else
36
+ DATA.read
37
+ end
38
+ end
39
+
40
+ # Returns true if groff is installed and in our path, false if
41
+ # not.
42
+ def groff?
43
+ system("which groff > /dev/null")
44
+ end
45
+
46
+ # The groff command complete with crazy arguments we need to run
47
+ # in order to turn our raw roff (manpage markup) into something
48
+ # readable on the terminal.
49
+ def groff_command
50
+ "groff -Wall -mtty-char -mandoc -Tascii"
51
+ end
52
+
53
+ # All calls to `puts` are paged, git-style.
54
+ def puts(*args)
55
+ page_stdout
56
+ super
57
+ end
58
+
59
+ # http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
60
+ def page_stdout
61
+ return unless $stdout.tty?
62
+
63
+ read, write = IO.pipe
64
+
65
+ if Kernel.fork
66
+ # Parent process, become pager
67
+ $stdin.reopen(read)
68
+ read.close
69
+ write.close
70
+
71
+ # Don't page if the input is short enough
72
+ ENV['LESS'] = 'FSRX'
73
+
74
+ # Wait until we have input before we start the pager
75
+ Kernel.select [STDIN]
76
+
77
+ pager = ENV['PAGER'] || 'less -isr'
78
+ pager = 'cat' if pager.empty?
79
+
80
+ exec pager rescue exec "/bin/sh", "-c", pager
81
+ else
82
+ # Child process
83
+ $stdout.reopen(write)
84
+ $stderr.reopen(write) if $stderr.tty?
85
+ read.close
86
+ write.close
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,52 @@
1
+ module Gist
2
+ module Standalone
3
+ extend self
4
+
5
+ PREAMBLE = <<-preamble
6
+ #!/usr/bin/env ruby
7
+ #
8
+ # This file, gist, is generated code.
9
+ # Please DO NOT EDIT or send patches for it.
10
+ #
11
+ # Please take a look at the source from
12
+ # http://github.com/defunkt/gist
13
+ # and submit patches against the individual files
14
+ # that build gist.
15
+ #
16
+
17
+ preamble
18
+
19
+ POSTAMBLE = "Gist.execute(*ARGV)\n"
20
+ __DIR__ = File.dirname(__FILE__)
21
+ MANPAGE = "__END__\n#{File.read(__DIR__ + '/../../man/gist.1')}"
22
+
23
+ def save(filename, path = '.')
24
+ target = File.join(File.expand_path(path), filename)
25
+ File.open(target, 'w') do |f|
26
+ f.puts build
27
+ f.chmod 0755
28
+ end
29
+ end
30
+
31
+ def build
32
+ root = File.dirname(__FILE__)
33
+
34
+ standalone = ''
35
+ standalone << PREAMBLE
36
+
37
+ Dir["#{root}/../**/*.rb"].each do |file|
38
+ # skip standalone.rb
39
+ next if File.expand_path(file) == File.expand_path(__FILE__)
40
+
41
+ File.readlines(file).each do |line|
42
+ next if line =~ /^\s*#/
43
+ standalone << line
44
+ end
45
+ end
46
+
47
+ standalone << POSTAMBLE
48
+ standalone << MANPAGE
49
+ standalone
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,3 @@
1
+ module Gist
2
+ VERSION = Version = '1.0.1'
3
+ end
@@ -0,0 +1,115 @@
1
+ .\" generated with Ron/v0.3
2
+ .\" http://github.com/rtomayko/ron/
3
+ .
4
+ .TH "GIST" "1" "February 2010" "GITHUB" "Gist Manual"
5
+ .
6
+ .SH "NAME"
7
+ \fBgist\fR \-\- gist on the command line
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBgist\fR [\fB\-p\fR] [\fB\-t extension\fR] \fIFILE\fR
11
+ .
12
+ .SH "DESCRIPTION"
13
+ \fBgist\fR can be used to create gists on gist.github.com from the command
14
+ line. There are two primary methods of creating gists.
15
+ .
16
+ .P
17
+ If standard input is supplied, it will be used as the content of the
18
+ new gist. If \fIFILE\fR is provided, the content of that file will be used
19
+ to create the gist.
20
+ .
21
+ .P
22
+ Once your gist is successfully created, the URL will be copied to your
23
+ clipboard. If you are on OS X, \fBgist\fR will open the gist in your
24
+ browser, too.
25
+ .
26
+ .SH "OPTIONS"
27
+ \fBgist\fR's default mode of operation is to read content from standard
28
+ input and create a public, text gist from it, tied to your GitHub
29
+ account if you user and token are provided (see \fBCONFIGURATION\fR).
30
+ .
31
+ .P
32
+ These options can be used to change this behavior:
33
+ .
34
+ .TP
35
+ \fB\-p\fR, \fB\-\-private\fR
36
+ Create a private gist instead of a public gist.
37
+ .
38
+ .TP
39
+ \fB\-t\fR, \fB\-\-type\fR
40
+ Set the file extension explicitly. Passing a type of \fBrb\fR ensure
41
+ the gist is created as a Ruby file.
42
+ .
43
+ .P
44
+ You may additionally ask for help:
45
+ .
46
+ .TP
47
+ \fB\-h\fR, \fB\-\-help\fR
48
+ Print help.
49
+ .
50
+ .TP
51
+ \fB\-m\fR, \fB\-\-man\fR
52
+ Display this man page.
53
+ .
54
+ .SH "CONFIGURATION"
55
+ Use git\-config(1) to display the currently configured GitHub username:
56
+ .
57
+ .IP "" 4
58
+ .
59
+ .nf
60
+
61
+ $ git config \-\-global github.user
62
+ .
63
+ .fi
64
+ .
65
+ .IP "" 0
66
+ .
67
+ .P
68
+ Or, set the GitHub username with:
69
+ .
70
+ .IP "" 4
71
+ .
72
+ .nf
73
+
74
+ $ git config \-\-global github.user <username>
75
+ .
76
+ .fi
77
+ .
78
+ .IP "" 0
79
+ .
80
+ .P
81
+ See \fIhttp://github.com/guides/local\-github\-config\fR for more
82
+ information.
83
+ .
84
+ .P
85
+ \fBgist\fR will check the \fBHTTP_PROXY\fR env variable if supplied:
86
+ .
87
+ .IP "" 4
88
+ .
89
+ .nf
90
+
91
+ $ HTTP_PROXY=http://host:port/ gist script.py
92
+ .
93
+ .fi
94
+ .
95
+ .IP "" 0
96
+ .
97
+ .SH "EXAMPLES"
98
+ .
99
+ .nf
100
+
101
+ $ gist < file.txt
102
+ $ echo secret | gist \-\-private
103
+ $ echo "puts :hi" | gist \-t rb
104
+ $ gist script.py
105
+ .
106
+ .fi
107
+ .
108
+ .SH "BUGS"
109
+ \fIhttp://github.com/defunkt/gist/issues\fR
110
+ .
111
+ .SH "AUTHOR"
112
+ Chris Wanstrath :: chris@ozmm.org
113
+ .
114
+ .SH "SEE ALSO"
115
+ hub(1), git(1), git\-clone(1),\fIhttp://github.com\fR, \fIhttp://github.com/defunkt/gist\fR
@@ -0,0 +1,169 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
+ <meta name='generator' value='Ron/v0.3'>
6
+ <title>gist(1) -- gist on the command line</title>
7
+ <style type='text/css'>
8
+ body {margin:0}
9
+ #man, #man code, #man pre, #man tt, #man kbd, #man samp {
10
+ font-family:consolas,monospace;
11
+ font-size:16px;
12
+ line-height:1.3;
13
+ color:#343331;
14
+ background:#fff; }
15
+ #man { max-width:89ex; text-align:justify; margin:0 25px 25px 25px }
16
+ #man h1, #man h2, #man h3 { color:#232221;clear:left }
17
+ #man h1 { font-size:28px; margin:15px 0 30px 0; text-align:center }
18
+ #man h2 { font-size:18px; margin-bottom:0; margin-top:10px; line-height:1.3; }
19
+ #man h3 { font-size:16px; margin:0 0 0 4ex; }
20
+ #man p, #man ul, #man ol, #man dl, #man pre { margin:0 0 18px 0; }
21
+ #man pre {
22
+ color:#333231;
23
+ background:#edeceb;
24
+ padding:5px 7px;
25
+ margin:0px 0 20px 0;
26
+ border-left:2ex solid #ddd}
27
+ #man pre + h2, #man pre + h3 {
28
+ margin-top:22px;
29
+ }
30
+ #man h2 + pre, #man h3 + pre {
31
+ margin-top:5px;
32
+ }
33
+ #man > p, #man > ul, #man > ol, #man > dl, #man > pre { margin-left:8ex; }
34
+ #man dt { margin:0; clear:left }
35
+ #man dt.flush { float:left; width:8ex }
36
+ #man dd { margin:0 0 0 9ex }
37
+ #man code, #man strong, #man b { font-weight:bold; color:#131211; }
38
+ #man pre code { font-weight:normal; color:#232221; background:inherit }
39
+ #man em, var, u {
40
+ font-style:normal; color:#333231; border-bottom:1px solid #999; }
41
+ #man h1.man-title { display:none; }
42
+ #man ol.man, #man ol.man li { margin:2px 0 10px 0; padding:0;
43
+ float:left; width:33%; list-style-type:none;
44
+ text-transform:uppercase; font-size:18px; color:#999;
45
+ letter-spacing:1px;}
46
+ #man ol.man { width:100%; }
47
+ #man ol.man li.tl { text-align:left }
48
+ #man ol.man li.tc { text-align:center;letter-spacing:4px }
49
+ #man ol.man li.tr { text-align:right }
50
+ #man ol.man a { color:#999 }
51
+ #man ol.man a:hover { color:#333231 }
52
+ </style>
53
+ </head>
54
+ <body>
55
+ <div id='man'>
56
+
57
+ <h1 class='man-title'>gist(1)</h1>
58
+
59
+ <ol class='head man'>
60
+ <li class='tl'>gist(1)</li>
61
+ <li class='tc'>Gist Manual</li>
62
+ <li class='tr'>gist(1)</li>
63
+ </ol>
64
+
65
+ <h2 id='NAME'>NAME</h2>
66
+ <p><code>gist</code> -- gist on the command line</p>
67
+ <h2>SYNOPSIS</h2>
68
+
69
+ <p><code>gist</code> [<code>-p</code>] [<code>-t extension</code>] <var>FILE</var></p>
70
+
71
+ <h2>DESCRIPTION</h2>
72
+
73
+ <p><code>gist</code> can be used to create gists on gist.github.com from the command
74
+ line. There are two primary methods of creating gists.</p>
75
+
76
+ <p>If standard input is supplied, it will be used as the content of the
77
+ new gist. If <var>FILE</var> is provided, the content of that file will be used
78
+ to create the gist.</p>
79
+
80
+ <p>Once your gist is successfully created, the URL will be copied to your
81
+ clipboard. If you are on OS X, <code>gist</code> will open the gist in your
82
+ browser, too.</p>
83
+
84
+ <h2>OPTIONS</h2>
85
+
86
+ <p><code>gist</code>'s default mode of operation is to read content from standard
87
+ input and create a public, text gist from it, tied to your GitHub
88
+ account if you user and token are provided (see <code>CONFIGURATION</code>).</p>
89
+
90
+ <p>These options can be used to change this behavior:</p>
91
+
92
+ <dl>
93
+ <dt>
94
+ <code>-p</code>, <code>--private</code>
95
+ </dt>
96
+ <dd><p>Create a private gist instead of a public gist.</p></dd>
97
+ <dt>
98
+ <code>-t</code>, <code>--type</code>
99
+ </dt>
100
+ <dd><p>Set the file extension explicitly. Passing a type of <code>rb</code> ensure
101
+ the gist is created as a Ruby file.</p></dd>
102
+ </dl>
103
+
104
+
105
+ <p>You may additionally ask for help:</p>
106
+
107
+ <dl>
108
+ <dt>
109
+ <code>-h</code>, <code>--help</code>
110
+ </dt>
111
+ <dd><p>Print help.</p></dd>
112
+ <dt>
113
+ <code>-m</code>, <code>--man</code>
114
+ </dt>
115
+ <dd><p>Display this man page.</p></dd>
116
+ </dl>
117
+
118
+
119
+ <h2>CONFIGURATION</h2>
120
+
121
+ <p>Use git-config(1) to display the currently configured GitHub username:</p>
122
+
123
+ <pre><code>$ git config --global github.user
124
+ </code></pre>
125
+
126
+ <p>Or, set the GitHub username with:</p>
127
+
128
+ <pre><code>$ git config --global github.user &lt;username&gt;
129
+ </code></pre>
130
+
131
+ <p>See <a href="http://github.com/guides/local-github-config">http://github.com/guides/local-github-config</a> for more
132
+ information.</p>
133
+
134
+ <p><code>gist</code> will check the <code>HTTP_PROXY</code> env variable if supplied:</p>
135
+
136
+ <pre><code>$ HTTP_PROXY=http://host:port/ gist script.py
137
+ </code></pre>
138
+
139
+ <h2>EXAMPLES</h2>
140
+
141
+ <pre><code>$ gist &lt; file.txt
142
+ $ echo secret | gist --private
143
+ $ echo "puts :hi" | gist -t rb
144
+ $ gist script.py
145
+ </code></pre>
146
+
147
+ <h2>BUGS</h2>
148
+
149
+ <p><a href="http://github.com/defunkt/gist/issues">http://github.com/defunkt/gist/issues</a></p>
150
+
151
+ <h2>AUTHOR</h2>
152
+
153
+ <p>Chris Wanstrath :: chris@ozmm.org</p>
154
+
155
+ <h2>SEE ALSO</h2>
156
+
157
+ <p>hub(1), git(1), git-clone(1),
158
+ <a href="http://github.com">http://github.com</a>,
159
+ <a href="http://github.com/defunkt/gist">http://github.com/defunkt/gist</a></p>
160
+
161
+ <ol class='foot man'>
162
+ <li class='tl'>GITHUB</li>
163
+ <li class='tc'>February 2010</li>
164
+ <li class='tr'>gist(1)</li>
165
+ </ol>
166
+
167
+ </div>
168
+ </body>
169
+ </html>
@@ -0,0 +1,80 @@
1
+ gist(1) -- gist on the command line
2
+ ===================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `gist` [`-p`] [`-t extension`] <FILE>
7
+
8
+ ## DESCRIPTION
9
+
10
+ `gist` can be used to create gists on gist.github.com from the command
11
+ line. There are two primary methods of creating gists.
12
+
13
+ If standard input is supplied, it will be used as the content of the
14
+ new gist. If <FILE> is provided, the content of that file will be used
15
+ to create the gist.
16
+
17
+ Once your gist is successfully created, the URL will be copied to your
18
+ clipboard. If you are on OS X, `gist` will open the gist in your
19
+ browser, too.
20
+
21
+ ## OPTIONS
22
+
23
+ `gist`'s default mode of operation is to read content from standard
24
+ input and create a public, text gist from it, tied to your GitHub
25
+ account if you user and token are provided (see `CONFIGURATION`).
26
+
27
+ These options can be used to change this behavior:
28
+
29
+ * `-p`, `--private`:
30
+ Create a private gist instead of a public gist.
31
+
32
+ * `-t`, `--type`:
33
+ Set the file extension explicitly. Passing a type of `rb` ensure
34
+ the gist is created as a Ruby file.
35
+
36
+ You may additionally ask for help:
37
+
38
+ * `-h`, `--help`:
39
+ Print help.
40
+
41
+ * `-m`, `--man`:
42
+ Display this man page.
43
+
44
+ ## CONFIGURATION
45
+
46
+ Use git-config(1) to display the currently configured GitHub username:
47
+
48
+ $ git config --global github.user
49
+
50
+ Or, set the GitHub username with:
51
+
52
+ $ git config --global github.user <username>
53
+
54
+ See <http://github.com/guides/local-github-config> for more
55
+ information.
56
+
57
+ `gist` will check the `HTTP_PROXY` env variable if supplied:
58
+
59
+ $ HTTP_PROXY=http://host:port/ gist script.py
60
+
61
+ ## EXAMPLES
62
+
63
+ $ gist < file.txt
64
+ $ echo secret | gist --private
65
+ $ echo "puts :hi" | gist -t rb
66
+ $ gist script.py
67
+
68
+ ## BUGS
69
+
70
+ <http://github.com/defunkt/gist/issues>
71
+
72
+ ## AUTHOR
73
+
74
+ Chris Wanstrath :: chris@ozmm.org
75
+
76
+ ## SEE ALSO
77
+
78
+ hub(1), git(1), git-clone(1),
79
+ <http://github.com>,
80
+ <http://github.com/defunkt/gist>
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gist
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Wanstrath
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-28 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: " Creates Gists (pastes) on gist.github.com from standard input or\n arbitrary files. Can link to your GitHub account, create private gists,\n and enable syntax highlighting.\n"
17
+ email: chris@ozmm.org
18
+ executables:
19
+ - gist
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README.markdown
26
+ - Rakefile
27
+ - LICENSE
28
+ - lib/gist/manpage.rb
29
+ - lib/gist/standalone.rb
30
+ - lib/gist/version.rb
31
+ - lib/gist.rb
32
+ - bin/gist
33
+ - man/gist.1
34
+ - man/gist.1.html
35
+ - man/gist.1.ron
36
+ has_rdoc: true
37
+ homepage: http://github.com/defunkt/gist
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.5
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Creates Gists from STDIN or files.
64
+ test_files: []
65
+