-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
50 lines (41 loc) · 1.13 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<h1>Create Menu like this</h1>
<pre><code>from askcli import Menu, Item
items = list()
# create items list
items = [Item('a', 'Action A'), Item('b', 'Action B'), 'action 3', Item('q', 'Quitter')]
m = Menu(items)
# print and wait keypress
m.launch()
print('_______')
print("you choose {0} : {1}".format(m.choose, m.get_choosen_text()))
</code></pre>
<strong>render</strong>
<pre><code> a - Action a
b - Action b
3 - action 3
q - Quitter
? input : f
X - error key, (unavailable)
? input : q
_______
toy choose menu q : Quitter
</code></pre>
<h1>Yes/No questions</h1>
<pre><code>from askcli.ask_bool import AskBool
a = AskBool('valid',t_text="Yes",f_text="No",required=True)
res = a.launch(err_mess="choose [yes] or [no]")
print('_____')
print("bool: {0}. choice {1}".format(res, a.get_text()))
</code></pre>
<strong>render</strong>
<pre><code>
? Confirmer [o/N] : yes
x choose [yes] or [no]
? Confirmer [o/N] : oui
_____
bool: True. choix Oui
</code></pre>
<p>
<img src="http://doc.thivolle-cazat.fr/public/askcli/logo-50.png" alt="AskCli_img"><br>
<a href="https://github.com/thivolle-cazat-cedric/py-askcli.git">github project</a>
</p>