personal 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10874368716c9d616d2e224d0a4ee8da54896342
4
- data.tar.gz: 4ec6a383fea739903da133305153758e4ca88db7
3
+ metadata.gz: 7850387e0f1a380247dfd8f1ea5510afcd924837
4
+ data.tar.gz: 4346083e02c0c7c91d8e660df2bed297f3a4fd38
5
5
  SHA512:
6
- metadata.gz: d225e38034a48cf481febbd7b335ed5906453a937332292de34b1f1bc42d66d2352fa73fd01d7c5336452aac4c00032cc3b2ce2a3fa3d53182a34beacbbb004c
7
- data.tar.gz: ba0fb5686ed92e44bd35a3bfb8c56c4d441ef2e3cbb08bb3132b81f694dcc3fbbd35bb95b15fa87a234a1606d4a9b7004773413e684b7832547b4897ae784b8e
6
+ metadata.gz: 05911a1af42b9de54790881d5b0f1f3a889130367ed19ff22967eab3d91ba6ce4cc0cfd574ddf7fd36de0a074f922f59d46181c1f5b66c9a32866a7ccce530f5
7
+ data.tar.gz: dffb946392d0a4c1985d1e0c9209ec5dd80fa33873d127bb212258a7ff21d202af01c42d3164583f6bc2d7cc4c310512bdb12c71f002226de4b12943a3bc3474
data/bin/personal CHANGED
@@ -30,6 +30,19 @@ class PersonalCommand < Thor
30
30
  @db_persistence.close_db
31
31
  end
32
32
 
33
+ desc "find", "find entry containing the given text"
34
+ method_option :text, :type => :string, :required => true, :aliases => "-t", :desc => "The text to find."
35
+ def find
36
+ if options[:text].include?("%") or options[:text].include?("_")
37
+ present_message "The text must not contain % or _", :light_red
38
+ return
39
+ end
40
+
41
+ init
42
+ present @db_persistence.find(options[:text])
43
+ @db_persistence.close_db
44
+ end
45
+
33
46
  desc "add", "Add a new entry to the personal diary"
34
47
  method_option :text, :type => :string, :required => true, :aliases => "-t", :desc => "The text to save."
35
48
  def add
@@ -1,3 +1,3 @@
1
1
  module Personal
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/personal.rb CHANGED
@@ -60,6 +60,10 @@ module Personal
60
60
  @db.execute("select * from (select * from personal order by created_at desc limit ?) order by created_at ASC", limit)
61
61
  end
62
62
 
63
+ def find(some_text)
64
+ @db.execute("select * from (select * from personal where data like ? order by created_at desc) order by created_at ASC", "%" + some_text + "%")
65
+ end
66
+
63
67
  def entries_by_year_and_month(year, month)
64
68
  @db.execute("select * from (select * from personal where cast(strftime('%Y', created_at) as integer) = ? and cast(strftime('%m', created_at) as integer) = ? order by created_at DESC) order by created_at ASC", year, month)
65
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: personal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jone Samra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3