greeenboii 0.1.2 → 0.1.6

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/dataSources/28fe2501-d682-44de-9f2e-9ff4bf02ce84/storage_v2/_src_/schema/main.uQUzAA.meta +2 -0
  3. data/.idea/dataSources/28fe2501-d682-44de-9f2e-9ff4bf02ce84.xml +1617 -0
  4. data/.idea/dataSources.local.xml +18 -0
  5. data/.idea/dataSources.xml +12 -0
  6. data/.idea/greeenboii.iml +6 -0
  7. data/.idea/sqldialects.xml +7 -0
  8. data/.idea/workspace.xml +71 -39
  9. data/.rubocop.sorbet.yml +5 -0
  10. data/.rubocop.yml +36 -0
  11. data/Makefile +269 -0
  12. data/exe/greeenboii +1 -1
  13. data/greeenboii_todo.db +0 -0
  14. data/lib/greeenboii/version.rb +1 -1
  15. data/lib/greeenboii.rb +96 -7
  16. data/sig/greeenboii/todo_list.rbs +30 -0
  17. data/sorbet/rbi/gems/.gitattributes +1 -0
  18. data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
  19. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
  20. data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +9 -0
  21. data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
  22. data/sorbet/rbi/gems/console_table@0.3.1.rbi +78 -0
  23. data/sorbet/rbi/gems/csv@3.3.2.rbi +9 -0
  24. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  25. data/sorbet/rbi/gems/httparty@0.22.0.rbi +2115 -0
  26. data/sorbet/rbi/gems/json@2.10.1.rbi +2120 -0
  27. data/sorbet/rbi/gems/language_server-protocol@3.17.0.4.rbi +9 -0
  28. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +86 -0
  29. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  30. data/sorbet/rbi/gems/minitest@5.25.4.rbi +1547 -0
  31. data/sorbet/rbi/gems/multi_xml@0.7.1.rbi +9 -0
  32. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  33. data/sorbet/rbi/gems/nokogiri@1.18.3.rbi +8205 -0
  34. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  35. data/sorbet/rbi/gems/parser@3.3.7.1.rbi +5525 -0
  36. data/sorbet/rbi/gems/prism@1.3.0.rbi +41403 -0
  37. data/sorbet/rbi/gems/racc@1.8.1.rbi +164 -0
  38. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  39. data/sorbet/rbi/gems/rake-compiler@1.2.9.rbi +9 -0
  40. data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
  41. data/sorbet/rbi/gems/rbi@0.2.4.rbi +4542 -0
  42. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3795 -0
  43. data/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi +7654 -0
  44. data/sorbet/rbi/gems/rubocop@1.72.2.rbi +61026 -0
  45. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  46. data/sorbet/rbi/gems/spoom@1.5.4.rbi +5026 -0
  47. data/sorbet/rbi/gems/sqlite3@2.6.0.rbi +1895 -0
  48. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3656 -0
  49. data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
  50. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
  51. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
  52. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  53. data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
  54. data/sorbet/tapioca/require.rb +6 -0
  55. data/src/main.c +19 -0
  56. metadata +55 -8
data/lib/greeenboii.rb CHANGED
@@ -8,6 +8,8 @@ require "console_table"
8
8
  require "nokogiri"
9
9
  require "httparty"
10
10
 
11
+ require "sqlite3"
12
+
11
13
  module Greeenboii
12
14
  class Error < StandardError; end
13
15
 
@@ -68,7 +70,7 @@ module Greeenboii
68
70
 
69
71
  title = result.css("h3").text.strip
70
72
  url = link["href"]
71
- snippet = result.css(".VwiC3b").text.strip
73
+ result.css(".VwiC3b").text.strip
72
74
 
73
75
  puts "Debug: Found Google result - Title: #{title}"
74
76
  results << url if url.start_with?("http")
@@ -98,6 +100,7 @@ module Greeenboii
98
100
  puts "Debug: Total results found: #{results.length}"
99
101
  results.take(8)
100
102
  end
103
+
101
104
  def self.display_results(results)
102
105
  CLI::UI.frame_style = :bracket
103
106
  CLI::UI::Frame.open(CLI::UI.fmt("{{green:Search Results}}")) do
@@ -111,17 +114,103 @@ module Greeenboii
111
114
  end
112
115
  end
113
116
 
117
+ class TodoList
118
+ def initialize
119
+ @db = setup_database
120
+ end
121
+
122
+ private def setup_database
123
+ db = SQLite3::Database.new("greeenboii_todo.db")
124
+ db.execute <<~SQL
125
+ CREATE TABLE IF NOT EXISTS todos (
126
+ id INTEGER PRIMARY KEY,
127
+ title TEXT NOT NULL,
128
+ completed BOOLEAN DEFAULT 0,
129
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
130
+ )
131
+ SQL
132
+ db
133
+ end
134
+
135
+ def add_task
136
+ title = CLI::UI.ask("Enter task title:")
137
+ return if title.empty?
138
+
139
+ @db.execute("INSERT INTO todos (title) VALUES (?)", [title])
140
+ puts CLI::UI.fmt "{{green:✓}} Task added successfully!"
141
+ end
142
+
143
+ def list_tasks
144
+ tasks = @db.execute("SELECT id, title, completed, created_at FROM todos ORDER BY created_at DESC")
145
+ if tasks.empty?
146
+ puts CLI::UI.fmt "{{yellow:⚠}} No tasks found"
147
+ return
148
+ end
149
+
150
+ ConsoleTable.define(%w[ID Title Status Created]) do |table|
151
+ tasks.each do |id, title, completed, created_at|
152
+ status = completed == 1 ? "{{green:✓}} Done" : "{{red:✗}} Pending"
153
+ table << [id, title, CLI::UI.fmt(status), created_at]
154
+ end
155
+ end
156
+ end
157
+
158
+ def mark_done
159
+ list_tasks
160
+ id = CLI::UI.ask("Enter task ID to mark as done:")
161
+ return if id.empty?
162
+
163
+ @db.execute("UPDATE todos SET completed = 1 WHERE id = ?", [id])
164
+ puts CLI::UI.fmt "{{green:✓}} Task marked as done!"
165
+ end
166
+
167
+ def delete_task
168
+ list_tasks
169
+ id = CLI::UI.ask("Enter task ID to delete:")
170
+ return if id.empty?
171
+
172
+ @db.execute("DELETE FROM todos WHERE id = ?", [id])
173
+ puts CLI::UI.fmt "{{green:✓}} Task deleted!"
174
+ end
175
+
176
+ def update_task
177
+ list_tasks
178
+ id = CLI::UI.ask("Enter task ID to update:")
179
+ return if id.empty?
180
+
181
+ title = CLI::UI.ask("Enter new title:")
182
+ return if title.empty?
183
+
184
+ @db.execute("UPDATE todos SET title = ? WHERE id = ?", [title, id])
185
+ puts CLI::UI.fmt "{{green:✓}} Task updated!"
186
+ end
187
+
188
+ def show_menu
189
+ CLI::UI::Frame.divider("{{v}} Todo List")
190
+ loop do
191
+ CLI::UI::Prompt.ask("Todo List Options:") do |handler|
192
+ handler.option("List Tasks") { list_tasks }
193
+ handler.option("Add Task") { add_task }
194
+ handler.option("Mark Done") { mark_done }
195
+ handler.option("Update Task") { update_task }
196
+ handler.option("Delete Task") { delete_task }
197
+ handler.option("Exit") { return }
198
+ end
199
+ end
200
+ end
201
+ end
202
+
114
203
  class Options
115
204
  def self.show_options
116
205
  CLI::UI::Prompt.instructions_color = CLI::UI::Color::GRAY
117
206
 
118
207
  CLI::UI::Prompt.ask("Choose an option:") do |handler|
119
- handler.option("{{gray:Search Files}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
120
- handler.option("{{gray:Search Directory}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
121
- handler.option("{{gray:Search Content}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
122
- handler.option("{{gray:Search History}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
123
- handler.option("{{cyan:Network Search}}") { |_selection| Search.perform_search }
124
- handler.option("{{red:Exit}}") { |_selection| exit }
208
+ handler.option("{{gray:Search Files}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
209
+ handler.option("{{gray:Search Directory}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
210
+ handler.option("{{gray:Search Content}}") { |selection| puts "Placeholder, Replaced soon. #{selection}" }
211
+ handler.option("{{yellow:Todo List}}") { |_selection| TodoList.new.show_menu }
212
+ handler.option("{{cyan:Search Engine}}") { |_selection| Search.perform_search }
213
+ handler.option("{{red:Exit}}") { |_selection| exit }
125
214
  end
126
215
  end
127
216
  end
@@ -0,0 +1,30 @@
1
+ module SQLite3
2
+ class Database
3
+ def initialize: (String) -> void
4
+ def execute: (String, ?Array[untyped]) -> Array[Array[untyped]]
5
+ end
6
+ end
7
+
8
+ module Greeenboii
9
+ class TodoList
10
+ @db: SQLite3::Database
11
+
12
+ def initialize: -> void
13
+
14
+ def add_task: -> (nil | untyped)
15
+
16
+ def list_tasks: -> (nil | Array[Array[untyped]])
17
+
18
+ def mark_done: -> (nil | untyped)
19
+
20
+ def delete_task: -> (nil | untyped)
21
+
22
+ def update_task: -> (nil | untyped)
23
+
24
+ def show_menu: -> nil
25
+
26
+ private
27
+
28
+ def setup_database: -> SQLite3::Database
29
+ end
30
+ end
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-generated=true