db-gui 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: 8a23c4423702e92a9b634a90e32d385ac6482ebe1259656a467469c483bfb50e
4
- data.tar.gz: a5dd6514f0d2dd0e0c06b9adc06b1df13ca36be01a3e205eb37aa101568c9117
3
+ metadata.gz: 9e8f8e99fbe6234688995ab9ba3c043520735be325f436d6a77b6645c000f949
4
+ data.tar.gz: ff6bbf33071bb6820260f6d583c448d218c448b9b304f242c2a448f197262c8c
5
5
  SHA512:
6
- metadata.gz: e3d60b076358330b17e79cc29f54e15f0fb72a7a5f2459bd1e319268d5c56dae9be0107bc0d3b6b3c1fcd7603c3e5666d7c9fecf3a83d7187b727cd8b8addc44
7
- data.tar.gz: 01c2e579505a3f05aea916a5b977911bbd344844bab274e7d457f88e66d7626e6bee9f6addba5fbb15df1b273045242bf8f2d8a84743a4d23f6488d284ef136c
6
+ metadata.gz: cb7ca28a2bc3c176c364e2708b8c2793d2b1cb0bb13e117511b83d4c35a021b76a47621a43cd6e41dacc3995c8d1e2e326946205dcd879a89e882560a01923ef
7
+ data.tar.gz: 9266bf6fe826ca5045f0c0819c8a9a673d5cb654465f5fa0366c3103e27f3fd7d896d3ee47a2f533ff734bc1a41c93b5d0e728b7ed4ffb9e7aba94e062fbdb10
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.2.3
4
+
5
+ - Edit -> Copy Table (with query & headers) menu item to copy table data with query (e.g. SQL) & headers as a formatted string to the clipboard
6
+
3
7
  ## 0.2.2
4
8
 
5
9
  - Edit -> Copy Table (with headers) menu item to copy table data with headers as a formatted string to the clipboard
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DB GUI (Database Graphical User Interface) 0.2.2
1
+ # DB GUI (Database Graphical User Interface) 0.2.3
2
2
  ## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer DSL for LibUI Application](https://github.com/AndyObtiva/glimmer-dsl-libui)
3
3
  [![Gem Version](https://badge.fury.io/rb/db-gui.svg)](http://badge.fury.io/rb/db-gui)
4
4
 
@@ -12,7 +12,7 @@ It currently supports PostgreSQL as a start, with the potential of supporting ma
12
12
 
13
13
  Run:
14
14
  ```
15
- gem install db-gui -v0.2.2
15
+ gem install db-gui -v0.2.3
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -32,11 +32,14 @@ Note that it stores the last connection details under `~/.db_gui`, and will auto
32
32
 
33
33
  Click on this menu item to copy the table data as a formatted string to the clipboard.
34
34
 
35
-
36
35
  **Edit -> Copy Table (with headers)**
37
36
 
38
37
  Click on this menu item to copy the table data with headers as a formatted string to the clipboard.
39
38
 
39
+ **Edit -> Copy Table (with query & headers)**
40
+
41
+ Click on this menu item to copy the table data with query (e.g. SQL) & headers as a formatted string to the clipboard.
42
+
40
43
  **Edit -> Copy Selected Row**
41
44
 
42
45
  Click on this menu item to copy the selected row data as a formatted string to the clipboard.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -103,14 +103,19 @@ class DbGui
103
103
  Clipboard.copy(formatted_table_string)
104
104
  end
105
105
 
106
- def copy_selected_row
106
+ def copy_table_with_headers
107
107
  return if db_command_result_rows.empty?
108
- Clipboard.copy(formatted_selected_row_string)
108
+ Clipboard.copy(formatted_table_string(include_headers: true))
109
109
  end
110
110
 
111
- def copy_table_with_headers
111
+ def copy_table_with_query_and_headers
112
112
  return if db_command_result_rows.empty?
113
- Clipboard.copy(formatted_table_string(include_headers: true))
113
+ Clipboard.copy(formatted_table_string(include_query: true, include_headers: true))
114
+ end
115
+
116
+ def copy_selected_row
117
+ return if db_command_result_rows.empty?
118
+ Clipboard.copy(formatted_selected_row_string)
114
119
  end
115
120
 
116
121
  def copy_selected_row_with_headers
@@ -118,16 +123,18 @@ class DbGui
118
123
  Clipboard.copy(formatted_selected_row_string(include_headers: true))
119
124
  end
120
125
 
121
- def formatted_table_string(rows = nil, include_headers: false)
126
+ def formatted_table_string(rows = nil, include_query: false, include_headers: false)
122
127
  rows ||= db_command_result_rows
123
128
  rows = rows.dup
124
129
  rows.prepend(db_command_result_headers) if include_headers
125
130
  column_max_lengths = row_column_max_lengths(rows) # TODO calculate those after prepending headers
126
- rows.map do |row|
131
+ formatted_string = rows.map do |row|
127
132
  row.each_with_index.map do |data, column_index|
128
133
  data.ljust(column_max_lengths[column_index])
129
134
  end.join(" | ")
130
135
  end.join(NEW_LINE)
136
+ formatted_string.prepend("#{db_command}\n\n") if include_query
137
+ formatted_string
131
138
  end
132
139
 
133
140
  def formatted_selected_row_string(include_headers: false)
@@ -31,6 +31,14 @@ class DbGui
31
31
  end
32
32
  }
33
33
 
34
+ menu_item('Copy Table (with query & headers)') {
35
+ enabled <= [db, :db_command_result_rows, computed_by: :db_command_result, on_read: -> (data) { !data.empty? }]
36
+
37
+ on_clicked do
38
+ db.copy_table_with_query_and_headers
39
+ end
40
+ }
41
+
34
42
  menu_item('Copy Selected Row') {
35
43
  enabled <= [db, :db_command_result_rows, computed_by: :db_command_result, on_read: -> (data) { !data.empty? }]
36
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db-gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh