Skip to content

Pretty-dir or pdir is a pretty print function for the dir() command.

License

Notifications You must be signed in to change notification settings

Athesto/pretty-dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pretty-dir

LICENSE-BADGE

Pretty-dir or pdir is a pretty print function for the dir() command.

  • It checks the size of the screen to shows a better output of dir. As the command ls in Linux.
  • It uses colors to diference public privated protected and dunder/magic elements

How to install

pip install pdir-athesto

How to use

Import the command and use the syntax

        pdir(<data>)
        pdir(<data>, <str>)

where <data> is any object and <str> must be "public" or "protected" or "private" or "magic" or "dunder"

Example

pdir vs dir

Use the manual

>>> help(pdir)

Extra: Automatic import

As a common function you should be able to use it in any moment without the need to import the package everytime.

So my recommendation is to use the PYTHONSTARTUP variable.
Copy this line into your .bashrc

export PYTHONSTARTUP=$HOME/.pythonrc

and create the .pythonrc with your favorite editor (*Cof, *Cof, Vim) and paste this line

#!/usr/bin/env python3
try:
    from pdir import pdir
except:
    pass

Suggestions

  • If you found something that should be there
  • Or you think that the redaction needs to be more specific
  • Or you think that you need something more (a feature)
  • Or there is something else

Please open an issue and tell me your idea.

Licence

GPLv3

Author

Hi, I'm Gustavo Mejía and if it's works to you. Please let me know in twitter in @im_tavo.

About

Pretty-dir or pdir is a pretty print function for the dir() command.

Topics

Resources

License

Stars

Watchers

Forks