basics 0.0.1 → 0.0.2

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 (2) hide show
  1. data/bin/basics +9 -3
  2. metadata +3 -3
data/bin/basics CHANGED
@@ -23,14 +23,20 @@ def get(url)
23
23
  end
24
24
  end
25
25
 
26
- case ARGV.size
27
- when 0
26
+ def usage
28
27
  puts "usage: #{$0} [term to search] [category (optional)]\nSee a list of available categories with #{$0} -l"
29
28
  exit
29
+ end
30
+
31
+ case ARGV.size
32
+ when 0
33
+ usage
30
34
  when 1
31
35
  if ARGV[0] == "-l"
32
36
  puts get(URL + "categories").sort.inspect
33
37
  exit
38
+ elsif ARGV[0] == "-h" || ARGV[0] == "--help"
39
+ usage
34
40
  end
35
41
  tips = get(URL + "search/#{ARGV[0]}")
36
42
  when 2
@@ -61,7 +67,7 @@ tips.each do |tip|
61
67
  prev_category = tip["category"]
62
68
  puts tip["category"].upcase.background(:red).foreground("#000000")
63
69
  end
64
- puts tip["title"].background(:white).foreground("#000000")
70
+ puts "##{tip["id"].to_s} ".background(:red) + tip["title"].background(:white).foreground("#000000")
65
71
  puts markdown.render(tip["text"])
66
72
  puts "\n\n\n"
67
73
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basics
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aditya Bhargava