File: prompt-script

package info (click to toggle)
libuser 1%3A0.64%2Bgit20241106~dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,184 kB
  • sloc: ansic: 16,599; python: 2,561; sh: 883; yacc: 782; makefile: 236; xml: 106
file content (39 lines) | stat: -rwxr-xr-x 869 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/python

def prompt(prompts):
	for p in prompts:
		p.value = "prompt answers, fast"

# main
import libuser

admin = libuser.admin()

prompts = [libuser.prompt(), libuser.prompt()]
prompts[0].prompt = "Enter some stuff"
prompts[0].visible = 1
prompts[0].defaultValue = "blah"
prompts[1].prompt = "Enter some invisible stuff"
prompts[1].visible = 0

print("Prompting using default prompter.")
admin.prompt(prompts)
print(prompts[0].value)
print(prompts[1].value)

print("\nPrompting using promptConsole.")
admin.promptConsole(prompts)
print(prompts[0].value)
print(prompts[1].value)

print("\nPrompting using python function.")
admin.prompt = prompt
admin.prompt(prompts)
print(prompts[0].value)
print(prompts[1].value)

print("\nPrompting using method.")
admin.prompt = admin.promptConsole
admin.prompt(prompts)
print(prompts[0].value)
print(prompts[1].value)