cocoadex 1.3 → 1.4

Sign up to get free protection for your applications and to get access to all the features.
data/bin/cocoadex CHANGED
@@ -13,7 +13,9 @@ logger.error_level = Logger::ERROR
13
13
  main do |query|
14
14
 
15
15
  logger.error_level = Logger::DEBUG if options[:verbose]
16
-
16
+ if options[:width] and width = options[:width].first.to_i
17
+ Cocoadex.width = width
18
+ end
17
19
  if options[:configure]
18
20
  DocSetHelper.search_and_index
19
21
  elsif options[:'load-docset']
@@ -45,6 +47,8 @@ on("--configure","Index all DocSets in default locations")
45
47
 
46
48
  on("--first","Load first result when multiple matches exist")
47
49
 
50
+ on("-w WIDTH","--width","Set the text width",/^(\d+)$/)
51
+
48
52
  on("-d DOCSET","--load-docset","Load a DocSet into the datastore",/^(.*)$/)
49
53
 
50
54
  # todo: support --platform, --platform-version, --format [format]
data/changelog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4
4
+
5
+ - Fixed parsing error on non-ASCII characters. Patch submitted by farcaller.
6
+ - Set width to use `$COLUMNS` environment variable, where available
7
+ - Added `--width` option, for manually setting the text width
8
+
3
9
  ## 1.3
4
10
 
5
11
  - Added `--configure` command, for finding and indexing
data/lib/cocoadex.rb CHANGED
@@ -19,8 +19,6 @@ require 'term/ansicolor'
19
19
 
20
20
  module Cocoadex
21
21
 
22
- DEFAULT_WIDTH = 72
23
-
24
22
  CONFIG_DIR=File.expand_path("~/.cocoadex")
25
23
 
26
24
  # output documentation text for a given search term
@@ -41,11 +39,11 @@ module Cocoadex
41
39
 
42
40
  # The maximum line width
43
41
  def self.width
44
- @width || DEFAULT_WIDTH
42
+ Bri.width
45
43
  end
46
44
 
47
45
  def self.width= width
48
- @width = width
46
+ Bri.width = width
49
47
  end
50
48
 
51
49
  # path to a file in the default configuration directory
@@ -66,4 +64,4 @@ module Cocoadex
66
64
  "#{' '*level}#{row}"
67
65
  end.join("\n")
68
66
  end
69
- end
67
+ end
@@ -1,11 +1,10 @@
1
-
2
1
  module Cocoadex
3
2
  # A top level element, roughly equivalent to one
4
3
  # page of documentation
5
4
  class Entity < Element
6
5
 
7
6
  def initialize path
8
- text = clean(IO.read(path))
7
+ text = clean(IO.read(path, :mode => 'rb'))
9
8
  document = Nokogiri::HTML(text)
10
9
  parse(document)
11
10
  end
@@ -1,3 +1,3 @@
1
1
  module Cocoadex
2
- VERSION = "1.3"
2
+ VERSION = "1.4"
3
3
  end
data/readme.md CHANGED
@@ -42,9 +42,6 @@ Cocoadex generates a tags file of all indexed search terms during configuration.
42
42
 
43
43
  complete -C /path/to/cocoadex_completion.sh -o default cocoadex
44
44
 
45
-
46
- I wish I knew how to get this working with zsh too.
47
-
48
45
  ## Example Output
49
46
 
50
47
  ### Property Lookup Example
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoadex
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-20 00:00:00.000000000 Z
12
+ date: 2012-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc