https://github.com/dn46/go-shell
Go-Shell is a simple shell implemented in Go. It supports basic commands, navigation with `cd`, and exiting with `exit`.
https://github.com/dn46/go-shell
go shell
Last synced: 6 months ago
JSON representation
Go-Shell is a simple shell implemented in Go. It supports basic commands, navigation with `cd`, and exiting with `exit`.
- Host: GitHub
- URL: https://github.com/dn46/go-shell
- Owner: dn46
- License: mit
- Created: 2024-05-25T10:33:44.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-25T11:37:22.000Z (about 2 years ago)
- Last Synced: 2024-06-03T04:28:55.810Z (about 2 years ago)
- Topics: go, shell
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# Go-Shell
Go-Shell is a simple shell implemented in Go. It supports basic commands, navigation with `cd`, and exiting with `exit`.
## Features
- Execute any command available in the PATH
- Navigate directories with `cd`
- `cd` with no arguments returns to the home directory
- Exit the shell with `exit`
- Colored output for username, hostname, and current directory
## Usage
To run the shell, simply execute:
```bash
make run
```
## Code Structure
- `Shell`: The main shell struct that contains a reader to read input from the user.
- `Run`: The main loop of the shell that prints the prompt, reads input, and executes the input.
- `execInput`: A function that takes a string input, parses it, and executes the command.
## Acknowledgements
This project is inspired and based on `Writing a simple shell in Go` found on this [blog post](https://blog.init-io.net/post/2018/07-01-go-unix-shell/). Give love to the author for making it available.
## License
[MIT](https://choosealicense.com/licenses/mit/)