sq 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sq +23 -2
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c519a54a2ee72ba956685aa2e5452f03bfce0e3
4
- data.tar.gz: 3c8b4709d73733bfc658ddde85a3ac79f76d59fc
3
+ metadata.gz: c9011404522da6bbfe9174b817f01f042951082c
4
+ data.tar.gz: 099d846bd7e759e5b75cc55fcb5204bb310c40f4
5
5
  SHA512:
6
- metadata.gz: b663c35c8905121c5e424b2bff1f1f2687a2afb256a1c424e06e3321f9afd711139614ae49e8f4b61c36c1dff776a4f68b0557c19438f9038d4f9c08f61604a4
7
- data.tar.gz: e0206d2b13ce469f6410f02b64ef6523f58148985ec5e6cba96d0a93fcc2de6f5dc013e2327f221fde18df09ef5da21b55682b6fe7ba553c0193222d52574541
6
+ metadata.gz: 5f06843d84adfaaa51d122872dc863a587bfd840f97dbe0c3e4867f544d4124063d3081dd89df1cb7b71db422f77ef09ef67523805e42f786101d4e4646085e0
7
+ data.tar.gz: a0154949e8708283ce6cf4c6d0014459fee5e70a3284ffebfe2a3a1729e7955e109dbe210ff3c80664d95f7bed860346a1ba39b2813ae2033a943fb8685b6ef9
data/bin/sq CHANGED
@@ -14,16 +14,37 @@ Usage:
14
14
  where [options] are:
15
15
  EOS
16
16
 
17
- opt :directory, 'Choose the output directory', :short => '-o', :type => :string, :default => '.'
18
17
  opt :verbose, 'Print more info', :short => '-V', :type => :bool, :default => false
18
+ opt :directory, 'Choose the output directory', :short => '-o', :type => :string, :default => '.'
19
19
  opt :format, 'Filename format', :short => '-F', :type => :string, :default => '%s.pdf'
20
+ opt :formats, 'List available formats', :type => :bool, :default => false
20
21
  end
21
22
 
22
- if ARGV.empty?
23
+ if ARGV.empty? && !opts[:formats]
23
24
  puts 'Error: No URI provided. Use -h or --help to see the help.'
24
25
  exit 1
25
26
  end
26
27
 
28
+ if opts[:formats]
29
+ puts <<-EOFMTS
30
+ A format is a string with zero or more placeholders, shown below. The default
31
+ is '%s.pdf'.
32
+
33
+ %n - PDF number, starting at 0
34
+ %N - PDF number, starting at 1
35
+ %z - same as %n, but zero-padded
36
+ %Z - same as %Z, but zero-padded
37
+ %c - total number of PDFs
38
+ %s - name of the PDF, extracted from its URI, without `.pdf`
39
+ %S - name of the PDF, extracted from the link text
40
+ %_ - same as %S, but spaces are replaced with underscores
41
+ %- - same as %S, but spaces are replaced with hyphens
42
+ %% - litteral %
43
+
44
+ EOFMTS
45
+ exit(0)
46
+ end
47
+
27
48
  url, *regex_parts = ARGV
28
49
  regex = regex_parts.join(' ')
29
50
 
@@ -3,7 +3,7 @@
3
3
  module SQ
4
4
  class << self
5
5
  def version
6
- '0.1.2'
6
+ '0.1.3'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Fontaine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-27 00:00:00.000000000 Z
11
+ date: 2014-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri