author | František Kučera <franta-hg@frantovo.cz> |
Mon, 04 Mar 2019 22:28:29 +0100 | |
branch | v_0 |
changeset 244 | 6bdb45af26d9 |
parent 200 | 2e351d7c26c4 |
child 250 | aae5009bd0af |
permissions | -rwxr-xr-x |
96 | 1 |
#!/usr/bin/perl |
2 |
||
3 |
# SQL-DK |
|
4 |
# Copyright © 2013 František Kučera (frantovo.cz) |
|
5 |
# |
|
6 |
# This program is free software: you can redistribute it and/or modify |
|
7 |
# it under the terms of the GNU General Public License as published by |
|
8 |
# the Free Software Foundation, either version 3 of the License, or |
|
9 |
# (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
||
19 |
||
20 |
# Parses Java source code from STDIN and generates simple help |
|
21 |
# Input (in this order): |
|
22 |
# info/globalcode/sql/dk/CLIParser.java |
|
23 |
# info/globalcode/sql/dk/CLIStarter.java |
|
24 |
||
25 |
# TODO: localization |
|
26 |
||
27 |
||
100
de65409a9f26
typo in help generator
František Kučera <franta-hg@frantovo.cz>
parents:
96
diff
changeset
|
28 |
print 'SQL-DK – an SQL batch client |
96 | 29 |
|
30 |
Options: |
|
31 |
||
32 |
'; |
|
33 |
||
34 |
while (<>) { |
|
200
2e351d7c26c4
InfoLister: new listings: --list-java-properties and --list-environment-variables
František Kučera <franta-hg@frantovo.cz>
parents:
100
diff
changeset
|
35 |
print " " . sprintf("%-32s", $1) . "$3\n" if (/"(.*?)".*? \/\/\s*bash-completion:option(\s*\/\/\s*help:(.*))?/); |
96 | 36 |
last if (/\/\/\s*help:exit-codes/); |
37 |
} |
|
38 |
||
39 |
print ' |
|
40 |
Examples: |
|
41 |
||
42 |
sql-dk --db MyDatabase --sql "SELECT * FROM table" |
|
43 |
||
44 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = ? AND b = ?" --data "abc" "def" |
|
45 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = :paramA AND b = :paramB" --data-named "paramA" "abc" "paramB" "def" |
|
46 |
||
47 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = ? AND b = ?" --types "varchar,integer" --data "abc" "123" |
|
48 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = :paramA AND b = :paramB" --types "paramA:varchar,paramB:integer" --data-named "paramA" "abc" "paramB" "123" |
|
49 |
||
50 |
Exit codes: |
|
51 |
||
52 |
'; |
|
53 |
||
54 |
while (<>) { |
|
55 |
print " $1 = $2\n" if (/EXIT_.*?=\s*(\d+)\s*;\s*\/\/\s*doc:(.*)/); |
|
56 |
} |
|
57 |
||
58 |
print "\n"; |