Package: pushdit
pushditInstallationpipinstallpushditImportfrompushditimportpushd,popd,pushitFeaturespushd:Tool that stores directories in a queueDirectory path MUST EXISTorFileNotFoundErrorCWD will always be placed at the end of the queueimportos>>>pushd-C:\Users\Antsthebul\Desktop\pushit;>>>pushd('tests')>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests;0tests1pushit>>>os.getcwd()'C:\\Users\\Antsthebul\\Desktop\\pushit\\tests'Instead of having to use a seperate command to view CWD AND directory queue,pushdwill echo the CWD as well as the directories that have been added to the queue. This is similar operation to thepushdanddirscommands inLinux. The list of directories thatpushdechoes, will be displayed in the order they were inserted,0being most recent. This is the order they will beswitchedto on default operation when usingpushit()as a contenxtmanager, otherwise when callingpopd(), will remove dir from back of queue.Whenpushdrecives a<..directory..>, unless specified pushd will move program to that directory. See examples below..Addingto 'front' of queue(Default)>>>pushd-C:\Users\Antsthebul\Desktop\pushit;>>>pushd('tests/pushtest1')>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests\pushtest1;0pushtest11pushitAddingto end of queue>>>pushd-C:\Users\Antsthebul\Desktop\pushit;>>>pushd('tests/pushtest1',right=True)>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests\pushtest1;0pushit1pushtest1>>>os.getcwd()'C:\\Users\\Antsthebul\\Desktop\\pushit\\tests\\pushtest1'Preventingdirectory change>>>pushd('pushtest2',chdir=False)# was in tests\pushtest1 when called>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests\pushtest1;0pushtest21pushit2pushtest1Clearentire queue and return to inital location of call (cwd @ runtime)>>>pushd.clear()>>>pushd-C:\Users\Antsthebul\Desktop\pushit;Relativepaths ok!>>>pushd('tests/pushtest1/pushtest2')>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests\pushtest1\pushtest2;0pushtest21pushit>>>pushd('../..')>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests;0tests1pushtest22pushitEven this...thing..>>>pushd-C:\Users\Ansthebul\Desktop\pushit;>>>pushd('~/documents')>>>pushd-C:\Users\Ansthebul\documents;0documents1pushitpopdRemovesingle directory from back of queue, like pop()>>>pushd('pushtest2',chdir=False)>>>popd()'C:\\Users\\Antsthbul\\pushit\\tests\\pushtest1'>>>pushd-C:\Users\Antsthebul\Desktop\pushit\tests\pushtest1;0pushtest21pushitSpecifydirectory to be removedFeature unavailablepushitWhere it all comes together..no argsThepushd queuemustbe populated>>>pushd('tests',chdir=False)>>>pushd('tests/pushtest1',chdir=False)>>>pushd('tests/pushtest1/pushtest2',chdir=False)>>>pushd()>>>pushd-C:\Users\Antsthebul\Desktop\\pushit;0pushtest21pushtest12tests3pushit>>>withpushit()aslvl1:...print('Do stuff here')...print(os.getcwd())...print()...withpushit()aslvl2:...print('Do more stuff here')...print(os.getcwd())...print()...withpushit()aslvl3:...print('OK i think you get the idea')...print(os.getcwd())...print()...print('Back in lvl2')...print(lvl2)...print('inside lvl1')...print(lvl1)DostuffhereC:\Users\Antsthebul\Desktop\pushit\tests\pushtest1\pushtest2DomorestuffhereC:\Users\Ansthebul\Desktop\pushit\tests\pushtest1OKithinkyougettheideaC:\Users\Ansthebul\Desktop\pushit\testsBackinlvl2-C:\Users\Ansthebul\Desktop\pushit\tests\pushtest1;insidelvl1-C:\Users\Ansthebul\Desktop\pushit\tests\pushtest1\pushtest2;0pushit>>>pushd-C:\Users\Ansthebul\Desktop\pushit;0pushit>>>os.getcwd()C:\Users\Antsthebul\Desktop\pushitwith args>>>pushd-C:\Users\Antsthebul\Desktop\\pushit;>>>withpushit('tests/pushtest1/pushest2'):...print(os.getcwd())C:\Users\Antsthebul\Desktop\pushit\tests\pushtest1\pushtest2>>>os.getcwd()'C:\\Users\\Antsthebul\\Desktop\\pushit'