pastr_it 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/pastr_it.rb +8 -6
  2. 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.2'
3
+ VERSION = '0.1.4'
4
4
  REALM = 'Pastr Registered User'
5
5
  PasteLink = "http://pastr.it/new"
6
6
  attr_accessor :password, :filename, :title, :network, :channel, :language, :username
@@ -13,21 +13,23 @@ class PastrIt
13
13
  def parse_args
14
14
  return @opts if @opts
15
15
  @opts = OptionParser.new
16
- @opts.banner = "\nUsage: pastr-it [options]\n"
16
+ @opts.banner = "\nUsage: pastr-it [options] FILE\n"
17
17
  @opts.on("-u", "--username USERNAME", "Your username (Default: #{@username})") { |foo| @username = foo }
18
18
  @opts.on("-c", "--channel CHANNEL", "IRC Channel for this Pastr (Default: same as username)") { |foo| @channel = foo }
19
19
  @opts.separator "\tWhen using your username as the channel argument, the paste will be private"
20
20
  @opts.on("-n", "--network NETWORK", "IRC Network for this Pastr (Default: #{network})") { |foo| @network = foo }
21
21
  @opts.on("-l", "--language LANGUAGE", "Language to use for syntax highlighting") { |foo| @language = foo }
22
- @opts.on("-t", "--title TITLE", "Title of this paste (Default: 'Pastr by #{username}')") { |foo| @title = foo }
23
- @opts.on("-f", "--file FILENAME", "Read paste_body from FILENAME (otherwise reads from stdin)") { |foo| @filename = foo }
24
- @opts.separator "\tTo paste from STDIN (instead of a file), you need to auth with a ~/.netrc"
22
+ @opts.on("-t", "--title TITLE", "Title of this paste (Default: Filename or 'Pastr by #{username}')") { |foo| @title = foo }
23
+ #@opts.on("-f", "--file FILENAME", "Read paste_body from FILENAME (otherwise reads from stdin)") { |foo| @filename = foo }
24
+ @opts.separator "\tTo paste from STDIN (instead of a file), leave off FILE, and you'll need to auth with a ~/.netrc"
25
25
 
26
26
  @opts.on_tail("-h", "--help", "Show this message") do
27
27
  puts @opts
28
28
  exit
29
29
  end
30
30
  @opts.parse!(@args)
31
+ @filename = ARGV.shift if ARGV.size == 1 and File.file?(ARGV.first)
32
+ @title ||= File.basename(@filename) if @filename
31
33
  @channel ||= @username
32
34
  if @filename.nil? and STDIN.isatty
33
35
  $stderr.puts "No Input on STDIN and no filename given, what am I supposed to paste?"
@@ -64,7 +66,7 @@ class PastrIt
64
66
  system("stty echo")
65
67
  end
66
68
  else
67
- STDERR.puts "Error: STDIN is not a tty (you supplied your paste through STDIN instead of -f FILE)"
69
+ STDERR.puts "Error: STDIN is not a tty (you supplied your paste through STDIN instead of a FILENAME)"
68
70
  STDERR.puts "Piping only works when using a ~/.netrc to supply login info, as the Password prompt needs STDIN to be a tty"
69
71
  exit 1
70
72
  end
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.2
4
+ version: 0.1.4
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-09 00:00:00 -05:00
15
+ date: 2009-04-10 00:00:00 -05:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency