pastr_it 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/pastr_it.rb +12 -3
- metadata +2 -2
data/lib/pastr_it.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "optparse"
|
2
2
|
class PastrIt
|
3
|
-
VERSION = '0.1.
|
3
|
+
VERSION = '0.1.7'
|
4
4
|
REALM = 'Pastr Registered User'
|
5
5
|
PasteLink = "http://pastr.it/new"
|
6
6
|
attr_accessor :password, :filename, :title, :network, :channel, :language, :username
|
@@ -20,25 +20,32 @@ class PastrIt
|
|
20
20
|
return @opts if @opts
|
21
21
|
@opts = OptionParser.new
|
22
22
|
@opts.banner = "\nUsage: pastr-it [options] FILE\n"
|
23
|
+
@opts.separator "\tTo paste from STDIN (instead of a file), leave off FILE, and you'll need to auth with a ~/.netrc"
|
23
24
|
@opts.on("-u", "--username USERNAME", "Your username (Default: #{@username})") { |foo| @username = foo }
|
24
25
|
@opts.on("-c", "--channel CHANNEL", "IRC Channel for this Pastr (Default: same as username)") { |foo| @channel = foo }
|
25
26
|
@opts.separator "\tWhen using your username as the channel argument, the paste will be private"
|
26
27
|
@opts.on("-n", "--network NETWORK", "IRC Network for this Pastr (Default: #{network})") { |foo| @network = foo }
|
27
28
|
@opts.on("-l", "--language LANGUAGE", "Language to use for syntax highlighting") { |foo| @language = foo }
|
28
29
|
@opts.on("-t", "--title TITLE", "Title of this paste (Default: Filename or 'Pastr by #{username}')") { |foo| @title = foo }
|
29
|
-
|
30
|
-
|
30
|
+
# coming soon
|
31
|
+
#@opts.on("-i", "--id PID", "ID Of paste to edit (instead of making a new paste)") { |foo| @pastr_id = foo }
|
32
|
+
#@opts.on("-a", "--annotate PID", "ID Of paste to annotate (incompatible with -i)") { |foo| @annotate_id = foo }
|
31
33
|
@opts.separator "\n---------------\n"
|
32
34
|
@opts.on("-L", "--list", "List supported languages") { |foo| @list_langs = true }
|
33
35
|
|
36
|
+
@opts.on("-v", "--version", "Print pastr version") { |foo| @version_only = true }
|
34
37
|
@opts.on_tail("-h", "--help", "Show this message") do
|
35
38
|
puts @opts
|
36
39
|
exit
|
37
40
|
end
|
38
41
|
@opts.parse!(@args)
|
42
|
+
|
39
43
|
if @list_langs
|
40
44
|
puts http_request(:url => "http://pastr.it/languages").content
|
41
45
|
exit
|
46
|
+
elsif @version_only
|
47
|
+
puts "pastr-it for http://pastr.it - Version: #{PastrIt::VERSION}"
|
48
|
+
exit
|
42
49
|
end
|
43
50
|
|
44
51
|
@filename = ARGV.shift if ARGV.size == 1 and File.file?(ARGV.first)
|
@@ -117,6 +124,8 @@ class PastrIt
|
|
117
124
|
print "\n"
|
118
125
|
rescue
|
119
126
|
system("stty echo")
|
127
|
+
ensure
|
128
|
+
system("stty echo")
|
120
129
|
end
|
121
130
|
else
|
122
131
|
STDERR.puts "Error: STDIN is not a tty (you supplied your paste through STDIN instead of a FILENAME)"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pastr_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jayson Vaughn
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-04-
|
15
|
+
date: 2009-04-11 00:00:00 -05:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|