geturl 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/geturl +10 -6
  3. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a759830473da0d7462c68059768185b2ae2fb502179afb05ba4fc3a6106560d6
4
- data.tar.gz: 131492d65e2bbd6a8b4f7641ec7cb127a7a1f658366ed48868263f1337998a20
3
+ metadata.gz: f19981b934099e642dcd5e4ccbdb0ae206aa07b296ce0f0bddbd65c05348c43f
4
+ data.tar.gz: be4975b3e283ae1f0d41b12dd78aab644b08597f4ad0e8db116db915436dbe8a
5
5
  SHA512:
6
- metadata.gz: 8d1ed7d9465bef8cb353c31169b56cc2c358e09454abc5807649ddf50581a439e9291a297e23ab1bc97e8c01e366b29059f37a3b744398911f0ae1fb1e6e1511
7
- data.tar.gz: c8780c99dc8cf87afc7d27e7fea336e551dd0fe48b0388d9a853af9fde2c08f605b62cd1789232eb062b977aa3ce8a27686ec14fa59a9e307f2bb6d78060bdb1
6
+ metadata.gz: 836883d1772fe8ecfcf8af6bc07408d76a02b897b61ecec43f8843315f68dc457ec5158bc6da902388ec78f14d4978e500b8efdfd697ec5adfca80225408e012
7
+ data.tar.gz: 1820d0b7fe2b16094292be981c32cf2cda644c34afe5f04b799f46b7c79783de099c3b29be8d94ff7dcd70eb5c1630ef20abbf4aed999df3d497aa852883946d
data/bin/geturl CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'cli-parser'
4
4
  require_relative '../lib/geturl'
5
5
  require 'mustache'
6
+ require 'colorize'
6
7
 
7
8
  module GetUrlCli
8
9
  extend self
@@ -10,12 +11,13 @@ module GetUrlCli
10
11
  # Reads the command line and runs the selected action.
11
12
  def run
12
13
  flags = %w(--save --delete --reload --sources --register --unregister
13
- --reload -v --show-all --match-all -a --only-urls -u --color --show-score)
14
+ --reload -v --show-all --match-all -a --only-urls -u --color -c --show-score)
14
15
  parameters = %w(--format --sources --tags --description --template -n)
15
16
  @arguments, @options = CliParser.parse(flags, parameters)
16
17
 
17
- @options['--match-all'] = @options['-a']
18
- @options['--only-urls'] = @options['-u']
18
+ @options['--match-all'] = @options['-a'] unless @options.include?('--match-all')
19
+ @options['--only-urls'] = @options['-u'] unless @options.include?('--only-urls')
20
+ @options['--color'] = @options['-c'] unless @options.include?('--color')
19
21
 
20
22
  if @options.include?('--save')
21
23
  save
@@ -46,6 +48,7 @@ module GetUrlCli
46
48
 
47
49
  geturl --format (json|yaml|mustache) keyword1 keyword2
48
50
  geturl --source [source] keyword1 keyword2
51
+ geturl --color keyword1 keyword2
49
52
 
50
53
  # Local bookmarked urls
51
54
  geturl --save http://www.example.com "Example website" --tags tag1,tag2 --description "This is an example"
@@ -195,10 +198,11 @@ module GetUrlCli
195
198
 
196
199
  # Outputs the given item as text.
197
200
  def output_item(item)
198
- puts item['name']
199
- puts item['url']
201
+ String.disable_colorization = !@options['--color']
202
+ puts item['name'].colorize(:green)
203
+ puts item['url'].colorize(:light_blue)
200
204
  puts item['description'] unless item['description'].to_s.empty?
201
- puts 'Tags: ' + item['tags'].join(', ') unless item['tags'].empty?
205
+ puts 'Tags: ' + item['tags'].join(', ').colorize(:gray) unless item['tags'].empty?
202
206
  if @options['--show-score']
203
207
  score = item['score']
204
208
  scored_keywords = item['scored_keywords']
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geturl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taco Jan Osinga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-29 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.8.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.8.1
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: mustache
15
35
  requirement: !ruby/object:Gem::Requirement