Mimics the behaviour of ls
command
The following arguments are implemented and categorised under argument group “pyls flags”:
Arg | Description |
---|---|
-A | List all files, including the once starting with “.” |
-l | Long list files with details such as size and time_modified |
-r | Reverse listing of files |
-t | Sort files by time_modified |
-h | Makes file sizes human readable |
--filter=<dir/file> | Filter based on content. If item contains contents, it is classified as a directory (dir), else it is a file. |
path | Path to list out. |
All flags are stackable.
# basic structure of code
pyls
|-- src
|-- pyls
|-- json
|-- structure.json
|-- __init__.py
|-- custom_exception.py
|-- item.py
|-- pyls_argument.py
|-- pyls.py
|-- test
Contains function to add above mentioned arguments.
Entrypoint
Loads the structure.json
file and creates corresponding Item
.
Based on provided argument, is extracts list of contents from inside an Item and displays it accordingly.
Contains structure of each item.
Depending on the presence of contents
inside of an item — it can be classified as either a directory or a file.
Currently only contains exception for InvalidPath which is raised if the path passed in args is not found.
- In terminal, navigate to the
pyls
directory. - Run the following command:
python -m pip install .
pyls
command should be working
Note: Running python -m pyls
works as well.