author | František Kučera <franta-hg@frantovo.cz> |
Fri, 20 Dec 2019 12:55:01 +0100 | |
branch | v_0 |
changeset 251 | 97dbb1015d98 |
parent 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 |
|
250
aae5009bd0af
fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents:
200
diff
changeset
|
8 |
# the Free Software Foundation, version 3 of the License. |
96 | 9 |
# |
10 |
# This program is distributed in the hope that it will be useful, |
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
# GNU General Public License for more details. |
|
14 |
# |
|
15 |
# You should have received a copy of the GNU General Public License |
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
||
18 |
||
19 |
# Parses Java source code from STDIN and generates simple help |
|
20 |
# Input (in this order): |
|
21 |
# info/globalcode/sql/dk/CLIParser.java |
|
22 |
# info/globalcode/sql/dk/CLIStarter.java |
|
23 |
||
24 |
# TODO: localization |
|
25 |
||
26 |
||
100
de65409a9f26
typo in help generator
František Kučera <franta-hg@frantovo.cz>
parents:
96
diff
changeset
|
27 |
print 'SQL-DK – an SQL batch client |
96 | 28 |
|
29 |
Options: |
|
30 |
||
31 |
'; |
|
32 |
||
33 |
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
|
34 |
print " " . sprintf("%-32s", $1) . "$3\n" if (/"(.*?)".*? \/\/\s*bash-completion:option(\s*\/\/\s*help:(.*))?/); |
96 | 35 |
last if (/\/\/\s*help:exit-codes/); |
36 |
} |
|
37 |
||
38 |
print ' |
|
39 |
Examples: |
|
40 |
||
41 |
sql-dk --db MyDatabase --sql "SELECT * FROM table" |
|
42 |
||
43 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = ? AND b = ?" --data "abc" "def" |
|
44 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = :paramA AND b = :paramB" --data-named "paramA" "abc" "paramB" "def" |
|
45 |
||
46 |
sql-dk --db MyDatabase --sql "SELECT * FROM table WHERE a = ? AND b = ?" --types "varchar,integer" --data "abc" "123" |
|
47 |
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" |
|
48 |
||
49 |
Exit codes: |
|
50 |
||
51 |
'; |
|
52 |
||
53 |
while (<>) { |
|
54 |
print " $1 = $2\n" if (/EXIT_.*?=\s*(\d+)\s*;\s*\/\/\s*doc:(.*)/); |
|
55 |
} |
|
56 |
||
57 |
print "\n"; |