db2c 0.0.2 → 0.0.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.
- data/bin/db2c +2 -20
- data/lib/db2c.rb +1 -1
- data/lib/db2c/command.rb +3 -0
- data/man/db2c.1 +66 -16
- data/man/db2c.1.html +28 -20
- data/man/db2c.1.ronn +33 -19
- metadata +1 -1
data/bin/db2c
CHANGED
@@ -10,28 +10,10 @@ if !ARGV.include?('--no-rlwrap') && !system("which rlwrap > /dev/null 2> /dev/nu
|
|
10
10
|
exit
|
11
11
|
end
|
12
12
|
|
13
|
-
def show_help
|
14
|
-
puts <<-help
|
15
|
-
Usage: db2c
|
16
|
-
|
17
|
-
Options:
|
18
|
-
--help Display this message
|
19
|
-
--man Display the man page
|
20
|
-
|
21
|
-
Bug reports, suggestions, updates: http://github.com/on-site/db2c
|
22
|
-
help
|
23
|
-
exit
|
24
|
-
end
|
25
|
-
|
26
|
-
if ARGV.any? { |arg| %w( -h --help -help help ).include?(arg) }
|
27
|
-
show_help
|
28
|
-
end
|
29
|
-
|
30
13
|
cdir = File.dirname(__FILE__)
|
31
|
-
|
14
|
+
unless (ARGV & %w{h help -help --help --man}).empty?
|
32
15
|
exec "man #{cdir}/../man/db2c.1"
|
33
16
|
end
|
34
|
-
|
35
17
|
unless ARGV.include? '--no-rlwrap'
|
36
18
|
exec "rlwrap -z pipeto -i -r -s 999999 -pBLUE -f #{cdir}/ac -H ~/.db2c_history db2c --no-rlwrap #{ARGV.join(' ')}"
|
37
19
|
end
|
@@ -39,7 +21,7 @@ end
|
|
39
21
|
$LOAD_PATH.unshift 'lib'
|
40
22
|
require "db2c"
|
41
23
|
|
42
|
-
Db2c::Command.debug = ARGV
|
24
|
+
Db2c::Command.debug = !(ARGV & %w{ -d --debug -debug debug }).empty?
|
43
25
|
|
44
26
|
loop do
|
45
27
|
print Db2c::Command.prompt
|
data/lib/db2c.rb
CHANGED
data/lib/db2c/command.rb
CHANGED
data/man/db2c.1
CHANGED
@@ -7,38 +7,88 @@
|
|
7
7
|
\fBdb2c\fR \- a db2 console with with history and autocomplete support
|
8
8
|
.
|
9
9
|
.SH "SYNOPSIS"
|
10
|
-
\fBdb2c\fR \fI\fIoptions\fR\fR
|
10
|
+
\fBdb2c\fR \fI\fIoptions\fR\fR
|
11
11
|
.
|
12
|
-
.SH "DESCRIPTION"
|
12
|
+
.SH "DESCRIPTION && EXAMPLES"
|
13
13
|
DB2 console mode does not support readline and autocomplete, this is a wrapper for the db2 command with support for both\.
|
14
14
|
.
|
15
|
-
.
|
15
|
+
.TP
|
16
|
+
\fBHistory\fR
|
17
|
+
.
|
18
|
+
.IP "" 4
|
19
|
+
.
|
20
|
+
.nf
|
21
|
+
|
22
|
+
|
23
|
+
db2 => connect to testdb (or: db2 => use testdb)
|
24
|
+
db2(testdb) => current date
|
25
|
+
db2(testdb) => \-107
|
26
|
+
(Use the arrows for history, you can also use \fICTRL\fR\-r to search the history)
|
27
|
+
.
|
28
|
+
.fi
|
29
|
+
.
|
30
|
+
.IP "" 0
|
31
|
+
|
32
|
+
.
|
33
|
+
.TP
|
34
|
+
\fBAutocomplete\fR
|
35
|
+
.
|
36
|
+
.IP "" 4
|
37
|
+
.
|
38
|
+
.nf
|
39
|
+
|
40
|
+
|
41
|
+
db2(testdb) => sel[double\-tab]
|
42
|
+
it remembers\.\.
|
43
|
+
db2(testdb) => list tables for schema xyz
|
44
|
+
db2(testdb) => select * from xyz\.tab[double\-tab]
|
45
|
+
.
|
46
|
+
.fi
|
47
|
+
.
|
48
|
+
.IP "" 0
|
49
|
+
|
50
|
+
.
|
51
|
+
.TP
|
52
|
+
\fBYou can pipe\fR
|
53
|
+
.
|
54
|
+
.IP "" 4
|
16
55
|
.
|
17
56
|
.nf
|
18
57
|
|
19
|
-
$ db2c
|
20
|
-
db2 => connect to testdb
|
21
|
-
or: db2 => use testdb
|
22
|
-
db2 => current date
|
23
|
-
db2 => \-107
|
24
58
|
|
25
|
-
|
59
|
+
db2(testdb) => select * from large\.table | grep \-v something
|
60
|
+
db2(testdb) => select * from large\.table | less
|
61
|
+
.
|
62
|
+
.fi
|
63
|
+
.
|
64
|
+
.IP "" 0
|
65
|
+
|
66
|
+
.
|
67
|
+
.TP
|
68
|
+
If a command outputs long lines, you can use \fBless \-S\fR
|
69
|
+
.
|
70
|
+
.IP "" 4
|
71
|
+
.
|
72
|
+
.nf
|
73
|
+
|
26
74
|
|
27
|
-
|
28
|
-
|
29
|
-
db2 => select * from large\.table | grep something
|
75
|
+
db2(testdb) => select * from table\.with\.many\.columns | less \-S
|
76
|
+
(you can scorll horizontally with left/right arrows)
|
30
77
|
.
|
31
78
|
.fi
|
79
|
+
.
|
80
|
+
.IP "" 0
|
81
|
+
|
32
82
|
.
|
33
83
|
.SH "OPTIONS"
|
34
84
|
.
|
35
85
|
.TP
|
36
|
-
\fB\-h\fR, \fB\-\-help\fR
|
37
|
-
Displays
|
86
|
+
\fB\-h\fR, \fB\-\-help\fR, \fB\-\-man\fR
|
87
|
+
Displays this help page\.
|
38
88
|
.
|
39
89
|
.TP
|
40
|
-
\fB\-\-
|
41
|
-
Displays
|
90
|
+
\fB\-\-debug\fR
|
91
|
+
Displays annoying messages\.
|
42
92
|
.
|
43
93
|
.SH "BUGS"
|
44
94
|
\fIhttp://github\.com/on\-site/db2c/issues\fR
|
data/man/db2c.1.html
CHANGED
@@ -55,8 +55,7 @@
|
|
55
55
|
<div class='man-navigation' style='display:none'>
|
56
56
|
<a href="#NAME">NAME</a>
|
57
57
|
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
-
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
-
<a href="#EXAMPLES">EXAMPLES</a>
|
58
|
+
<a href="#DESCRIPTION-EXAMPLES">DESCRIPTION && EXAMPLES</a>
|
60
59
|
<a href="#OPTIONS">OPTIONS</a>
|
61
60
|
<a href="#BUGS">BUGS</a>
|
62
61
|
<a href="#AUTHOR">AUTHOR</a>
|
@@ -76,32 +75,41 @@
|
|
76
75
|
|
77
76
|
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
78
77
|
|
79
|
-
<p><code>db2c</code> <var><a href="#OPTIONS" title="OPTIONS" data-bare-link="true">options</a></var
|
78
|
+
<p><code>db2c</code> <var><a href="#OPTIONS" title="OPTIONS" data-bare-link="true">options</a></var></p>
|
80
79
|
|
81
|
-
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
80
|
+
<h2 id="DESCRIPTION-EXAMPLES">DESCRIPTION && EXAMPLES</h2>
|
82
81
|
|
83
82
|
<p>DB2 console mode does not support readline and autocomplete, this is a wrapper for the db2 command with support for both.</p>
|
84
83
|
|
85
|
-
<
|
86
|
-
|
87
|
-
|
88
|
-
db2
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
84
|
+
<dl>
|
85
|
+
<dt class="flush"><strong>History</strong></dt><dd><p></p><pre>
|
86
|
+
db2 => connect to testdb (or: db2 => use testdb)
|
87
|
+
db2(testdb) => current date
|
88
|
+
db2(testdb) => -107
|
89
|
+
(Use the arrows for history, you can also use <var>CTRL</var>-r to search the history)
|
90
|
+
</pre></dd>
|
91
|
+
<dt><strong>Autocomplete</strong></dt><dd><p></p><pre>
|
92
|
+
db2(testdb) => sel[double-tab]
|
93
|
+
it remembers..
|
94
|
+
db2(testdb) => list tables for schema xyz
|
95
|
+
db2(testdb) => select * from xyz.tab[double-tab]
|
96
|
+
</pre></dd>
|
97
|
+
<dt><strong>You can pipe</strong></dt><dd><p></p><pre>
|
98
|
+
db2(testdb) => select * from large.table | grep -v something
|
99
|
+
db2(testdb) => select * from large.table | less
|
100
|
+
</pre></dd>
|
101
|
+
<dt>If a command outputs long lines, you can use <strong>less -S</strong></dt><dd><p></p><pre>
|
102
|
+
db2(testdb) => select * from table.with.many.columns | less -S
|
103
|
+
(you can scorll horizontally with left/right arrows)
|
104
|
+
</pre></dd>
|
105
|
+
</dl>
|
94
106
|
|
95
|
-
You can pipe:
|
96
|
-
db2 => select * from large.table | less
|
97
|
-
db2 => select * from large.table | grep something
|
98
|
-
</code></pre>
|
99
107
|
|
100
108
|
<h2 id="OPTIONS">OPTIONS</h2>
|
101
109
|
|
102
110
|
<dl>
|
103
|
-
<dt><code>-h</code>, <code>--help</code></dt><dd><p>Displays
|
104
|
-
<dt class="flush"><code>--
|
111
|
+
<dt><code>-h</code>, <code>--help</code>, <code>--man</code></dt><dd><p>Displays this help page.</p></dd>
|
112
|
+
<dt class="flush"><code>--debug</code></dt><dd><p>Displays annoying messages.</p></dd>
|
105
113
|
</dl>
|
106
114
|
|
107
115
|
|
@@ -111,7 +119,7 @@ db2 => select * from large.table | grep something
|
|
111
119
|
|
112
120
|
<h2 id="AUTHOR">AUTHOR</h2>
|
113
121
|
|
114
|
-
<p>Samer Abukhait <a href="&#
|
122
|
+
<p>Samer Abukhait <a href="mailto:samer@on-siteNOSPAM.com" data-bare-link="true">samer@on-siteNOSPAM.com</a>, @s4mer</p>
|
115
123
|
|
116
124
|
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
117
125
|
|
data/man/db2c.1.ronn
CHANGED
@@ -3,33 +3,47 @@ db2c(1) - a db2 console with with history and autocomplete support
|
|
3
3
|
|
4
4
|
## SYNOPSIS
|
5
5
|
|
6
|
-
`db2c` <[options]>
|
6
|
+
`db2c` <[options]>
|
7
7
|
|
8
|
-
## DESCRIPTION
|
8
|
+
## DESCRIPTION && EXAMPLES
|
9
9
|
|
10
10
|
DB2 console mode does not support readline and autocomplete, this is a wrapper for the db2 command with support for both.
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
db2 =>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
db2 =>
|
12
|
+
* **History**:
|
13
|
+
<pre>
|
14
|
+
db2 => connect to testdb (or: db2 => use testdb)
|
15
|
+
db2(testdb) => current date
|
16
|
+
db2(testdb) => -107
|
17
|
+
(Use the arrows for history, you can also use <CTRL>-r to search the history)
|
18
|
+
</pre>
|
19
|
+
|
20
|
+
* **Autocomplete**:
|
21
|
+
<pre>
|
22
|
+
db2(testdb) => sel[double-tab]
|
23
|
+
it remembers..
|
24
|
+
db2(testdb) => list tables for schema xyz
|
25
|
+
db2(testdb) => select * from xyz.tab[double-tab]
|
26
|
+
</pre>
|
27
|
+
|
28
|
+
* **You can pipe**:
|
29
|
+
<pre>
|
30
|
+
db2(testdb) => select * from large.table | grep -v something
|
31
|
+
db2(testdb) => select * from large.table | less
|
32
|
+
</pre>
|
33
|
+
|
34
|
+
* If a command outputs long lines, you can use **less -S**:
|
35
|
+
<pre>
|
36
|
+
db2(testdb) => select * from table.with.many.columns | less -S
|
37
|
+
(you can scorll horizontally with left/right arrows)
|
38
|
+
</pre>
|
25
39
|
|
26
40
|
## OPTIONS
|
27
41
|
|
28
|
-
* `-h`, `--help`:
|
29
|
-
Displays
|
42
|
+
* `-h`, `--help`, `--man`:
|
43
|
+
Displays this help page.
|
30
44
|
|
31
|
-
* `--
|
32
|
-
Displays
|
45
|
+
* `--debug`:
|
46
|
+
Displays annoying messages.
|
33
47
|
|
34
48
|
## BUGS
|
35
49
|
|