my-ls is a custom implementation of the Unix ls command in Go, developed to explore system interactions and data handling. This project replicates key features of the original ls command, while implementing some unique functionalities and following Go best practices. Features
The following flags are supported:
-l: Detailed list format, showing file permissions, ownership, size, and modification date, similar to the output of ls -l.
-R: Recursively list files in all directories and subdirectories.
-a: Display all files, including hidden ones (files starting with .).
-r: Reverse the sorting order.
-t: Sort files by modification time, newest first.You can combine flags in various ways, just as with the standard ls.
You can use my-ls with any combination of supported flags:
my-ls [flags] [directory]Examples:
my-ls # Lists files and directories in the current directory.
my-ls -l # Displays detailed information about each file in the current directory.
my-ls -a -R /path/to/dir # Recursively lists all files (including hidden) in /path/to/dir.
my-ls -t -r # Lists files in reverse chronological order of modification. Recursive Flag (-R): Implementing this requires careful handling of nested directories. Plan how recursive directory traversal interacts with other flags.
Sorting and Filtering: Sorting by time (-t) and reversing order (-r) should handle multiple flags simultaneously.
ls -l: Match the output format exactly to that of the system ls -l command, ensuring file permissions, ownership, and other metadata are displayed correctly.To clone the project, use:
git clone https://learn.zone01kisumu.ke/git/johnotieno0/my-ls-1.gitcd my-ls-1Run
After navigating to the project directory, build the project:
go run . [flags] [directory]License
This project is licensed under the MIT License.