Skip to content

Commit 5b39e37

Browse files
authored
Update README.md
1 parent 6499649 commit 5b39e37

File tree

1 file changed

+84
-2
lines changed

1 file changed

+84
-2
lines changed

README.md

+84-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,84 @@
1-
# Command-Shell
2-
Command Shell implemented in Python with import functionalities 🐚🐍
1+
# Command Shell
2+
3+
## Overview
4+
This Python-based Command Shell is a simple CLI (Command Line Interface) application that mimics basic functionalities of a typical shell. It allows users to navigate directories, list contents, execute external commands, and customize the shell prompt.
5+
6+
## Features
7+
- Change directory (`cd`)
8+
- List directory contents (`ls`)
9+
- Execute external commands
10+
- Exit the shell (`exit`)
11+
- Customize the shell prompt (`prompt`)
12+
13+
## Requirements
14+
- Python 3.x
15+
16+
## Installation
17+
1. Ensure you have Python 3.x installed on your system.
18+
2. Download or clone the shell script to your local machine.
19+
20+
## How to Use
21+
1. Open your terminal or command prompt.
22+
2. Navigate to the directory where the script is located.
23+
3. Run the script using Python:
24+
```sh
25+
python shell.py
26+
```
27+
28+
## Commands
29+
### `cd <directory>`
30+
- Change the current working directory.
31+
- Example:
32+
```sh
33+
cd /path/to/directory
34+
```
35+
36+
### `ls [directory]`
37+
- List the contents of the specified directory. If no directory is specified, it lists the contents of the current directory.
38+
- Example:
39+
```sh
40+
ls /path/to/directory
41+
```
42+
43+
### `exit`
44+
- Exit the shell.
45+
46+
### `prompt <format>`
47+
- Customize the shell prompt format.
48+
- Placeholders:
49+
- `$PWD$`: Current working directory
50+
- `$HOME$`: Home directory
51+
- Example:
52+
```sh
53+
prompt MyShell:$PWD$>
54+
```
55+
56+
### Executing External Commands
57+
- Any command not recognized as a built-in command will be executed as an external command using `subprocess.run`.
58+
- Example:
59+
```sh
60+
python --version
61+
```
62+
63+
## Output Screenshots
64+
65+
![image](https://github.com/SaadARazzaq/Command-Shell/assets/123338307/8edf1f68-0d40-486f-a7d4-dc5160a169b5)
66+
67+
## Test Cases:
68+
69+
![image](https://github.com/SaadARazzaq/Command-Shell/assets/123338307/433dca4b-455f-4bbd-83d8-9d4bdf6a435c)
70+
![image](https://github.com/SaadARazzaq/Command-Shell/assets/123338307/0a2fc73e-abdb-4431-89a9-fd19cf261842)
71+
72+
## Developer Notes
73+
- The shell uses the `os` module for directory operations and the `subprocess` module to run external commands.
74+
- The `self.prompt_format` variable stores the format of the shell prompt, which can be customized using the `prompt` command.
75+
- The `handle_command` method parses user input and calls the appropriate method to handle the command.
76+
77+
## Future Enhancements
78+
- Add support for more built-in commands.
79+
- Implement command history and autocomplete features.
80+
- Improve error handling and user feedback.
81+
82+
---
83+
84+
Enjoy using the Command Shell! If you encounter any issues or have suggestions for improvements, feel free to contribute or open an issue.

0 commit comments

Comments
 (0)