cmd.py
· 915 B · Python
Raw
#!/usr/bin/env python3
#coding:utf-8
import cmd
completions = [
'Mage Slayer (Alara Reborn)',
'Magefire Wings (Alara Reborn)',
'Sages of the Anima (Alara Reborn)',
'Sanctum Plowbeast (Alara Reborn)',
'Sangrite Backlash (Alara Reborn)',
'Sanity Gnawers (Alara Reborn)',
'Sen Triplets (Alara Reborn)'
]
class principale(cmd.Cmd):
intro = "bonjour"
prompt = "(principal) "
def do_add(self, arg):
pass
def complete_add(self, text, line, begidx, endidx):
mline = line.partition(' ')[2]
offs = len(mline) - len(text)
return [s[offs:] for s in completions if s.startswith(mline)]
def do_secondaire(self, arg):
secondaire().cmdloop()
def do_exit(self, arg):
return True
def do_q(self, arg):
return True
class secondaire(cmd.Cmd):
prompt = "(principale - secondaire) "
def do_exit(self, arg):
return True
principale().cmdloop()
| 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() |