Skip to content

Commit 069af0b

Browse files
author
nikolay
committed
interactive menu, initial version
1 parent 5e57804 commit 069af0b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

index.psql

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
\echo Menu:
2+
\echo ' 1 – Database object sizes'
3+
\echo ' 2 – Bloat'
4+
\echo ' 3 – pg_stat_statementis'
5+
\echo ' q – Quit from this tool'
6+
\echo
7+
\echo 'Type your choice (1-3) and press <Enter>:'
8+
\prompt d_step_unq
9+
\set d_stp '\'' :d_step_unq '\''
10+
select
11+
:d_stp::text = '1' as d_step_is_1,
12+
:d_stp::text = '2' as d_step_is_2,
13+
:d_stp::text = '3' as d_step_is_3,
14+
:d_stp::text = 'q' as d_step_is_q \gset
15+
\if :d_step_is_1
16+
\echo ' 1 is chosen!'
17+
\prompt 'Press any key…' d_dummy
18+
\i index.sql
19+
\elif :d_step_is_2
20+
\echo ' 2 is chosen!'
21+
\prompt 'Press any key…' d_dummy
22+
\i index.sql
23+
\elif :d_step_is_3
24+
\echo ' 3 is chosen!'
25+
\prompt 'Press any key…' d_dummy
26+
\i index.sql
27+
\elif :d_step_is_q
28+
\echo '...bye!'
29+
\else
30+
\echo 'ERROR: Unkown option!'
31+
\i index.sql
32+
\endif

0 commit comments

Comments
 (0)