Dec-27-2021, 01:33 AM
(This post was last modified: Dec-27-2021, 01:33 AM by BashBedlam.)
I think this comes pretty close to what you're asking. First, put this code in a file called
newcommands
. Then start the interactive interpreter with this:PYTHONSTARTUP=newcommands python3
. Then you can typec.die
orc.ls
orc.pwd
. Try it and then add all the commands you like.import os class Commands : @property def ls (self) : directory_list = os.listdir () for filename in directory_list : print (filename) @property def pwd (self) : print (os.getcwd()) @property def die (self) : exit () c = Commands () ''' c.ls c.pwd c.die '''