**Exp** short form of **Explain** is a command-line tool that provides detailed information about the contents of a directory or a file. It can be used as an alternative to common Unix commands like `ls` and `cat`, offering additional features such as displaying the top 10 rows of a CSV file and calculating the total sizes of directories and files.
The tool also presents the data in a well-formatted table for easy readability, using pretty printing techniques.
-
Directory Size Information:
- Shows the total size of a directory and its subdirectories (recursively) along with individual file sizes.
- Displays folder and file information in a table with size and type details.
-
File Content Display:
- If a file is specified, the tool will print the contents of the file to the terminal, similar to the
catcommand. - If the file is a CSV, it will display the first 10 rows in a well-formatted table.
- If a file is specified, the tool will print the contents of the file to the terminal, similar to the
-
File Type Detection:
- Detects the type of file based on its extension and displays it in the output table.
-
Progress Bar:
- A progress bar is displayed while calculating the size of large directories to track the process.
choco install explainor download the lastest binary form Here. Add downloaded binary path to environment variable.
Verify Installation: Close the current CMD window and open a new one. Verify that your CLI tool works by typing its name:
explainIf everything is set up correctly, the command should now work globally from any directory.
Coming Soon
Coming Soon
You need to have Rust installed to build and run this tool.
-
Clone the repository:
git clone https://github.com/xtareq/explain cd explain -
Build the project:
cargo build --release
-
Optionally, install the tool globally:
cargo install --path .
To use the tool, run the following command:
explain [path]-
View contents of the current directory:
explain
This will display the contents of the current directory, showing folders, files, and their sizes.
-
View directory information for a specific path:
explain /path/to/directory
This will list all subdirectories and files in the given path, along with their sizes.
-
View file content:
explain /path/to/file.txt
This will print the content of the file to the terminal, similar to the
catcommand. -
View top 10 rows of a CSV file:
explain /path/to/file.csv
This will display the first 10 rows of the CSV file in a tabular format.
You can also use the short alias exp to execute the same commands.
exp [path]-
Directory Size Calculation: The program recursively calculates the size of each directory and its subdirectories using
fs::read_dirandmetadata()to gather file and directory information. It skips any files or directories that cannot be accessed due to permission errors. -
File Type Detection: The program detects file types based on their extensions. It includes a predefined list of common file extensions like
.rsfor Rust,.pyfor Python,.jpgfor JPEG images, etc. -
CSV Display: If a CSV file is detected, it reads the top 10 rows and displays them in a nicely formatted table using the
prettytablecrate. -
Progress Bar: The progress bar is shown while the directory size is being calculated. It updates as the program scans each entry in the directory.
Feel free to submit pull requests for improvements or bug fixes. Please make sure to run the tests and follow standard Rust coding practices.
This project is licensed under the MIT License.

