nithir revised this gist . Go to revision
No changes
nithir revised this gist . Go to revision
1 file changed, 43 insertions
cmd.py(file created)
| @@ -0,0 +1,43 @@ | |||
| 1 | + | #!/usr/bin/env python3 | |
| 2 | + | #coding:utf-8 | |
| 3 | + | ||
| 4 | + | import cmd | |
| 5 | + | ||
| 6 | + | completions = [ | |
| 7 | + | 'Mage Slayer (Alara Reborn)', | |
| 8 | + | 'Magefire Wings (Alara Reborn)', | |
| 9 | + | 'Sages of the Anima (Alara Reborn)', | |
| 10 | + | 'Sanctum Plowbeast (Alara Reborn)', | |
| 11 | + | 'Sangrite Backlash (Alara Reborn)', | |
| 12 | + | 'Sanity Gnawers (Alara Reborn)', | |
| 13 | + | 'Sen Triplets (Alara Reborn)' | |
| 14 | + | ] | |
| 15 | + | ||
| 16 | + | class principale(cmd.Cmd): | |
| 17 | + | intro = "bonjour" | |
| 18 | + | prompt = "(principal) " | |
| 19 | + | ||
| 20 | + | def do_add(self, arg): | |
| 21 | + | pass | |
| 22 | + | ||
| 23 | + | def complete_add(self, text, line, begidx, endidx): | |
| 24 | + | mline = line.partition(' ')[2] | |
| 25 | + | offs = len(mline) - len(text) | |
| 26 | + | return [s[offs:] for s in completions if s.startswith(mline)] | |
| 27 | + | ||
| 28 | + | def do_secondaire(self, arg): | |
| 29 | + | secondaire().cmdloop() | |
| 30 | + | ||
| 31 | + | def do_exit(self, arg): | |
| 32 | + | return True | |
| 33 | + | ||
| 34 | + | def do_q(self, arg): | |
| 35 | + | return True | |
| 36 | + | ||
| 37 | + | class secondaire(cmd.Cmd): | |
| 38 | + | prompt = "(principale - secondaire) " | |
| 39 | + | ||
| 40 | + | def do_exit(self, arg): | |
| 41 | + | return True | |
| 42 | + | ||
| 43 | + | principale().cmdloop() | |
Newer
Older