How r-pavan-2503/own_shell works
Main Components
• Shell Entry Point: This is your main application (src/main.cpp) that starts the shell.
• Input Handler: A component that captures user input. It could be abstracted as a “Command Input” module.
• Command Parser: A module that processes the raw input string into tokens/commands. It will determine if the command is a built-in function or an external command.
• Built-in Methods Manager: Since there is a file named inbuiltmethods.txt, you may have a mechanism to load and manage built-in commands. Add a module that reads this file and maps commands.
• Command Executor: This is responsible for executing either the built-in commands or, for external commands, using system calls like fork/exec (if implemented).
Relationships and Interactions
• Flow starts at the Shell’s Entry Point, which initializes the shell and then continuously reads input.
• The Input Handler obtains the command from the user and forwards it to the Command Parser.
• The Command Parser decides whether the command matches one of the built-in commands (by referencing the Built-in Methods Manager, potentially sourced from inbuiltmethods.txt).
• Depending on the match, the command is passed to the Command Executor that performs the appropriate action—either processes a built-in operation or executes an external command.
• The results (output, errors) are sent back to the output handler to display to the user, completing the cycle.
Architectural Patterns and Principles
• Modular design: Even in a small project, separate the concerns (input, parsing, execution) into distinct modules.
• Error Handling: Although simple, any failure in parsing or execution should lead to appropriate user feedback.
Relevant Technologies
• Programming Language: C++
• Build System: CMake (as indicated by CMakeLists.txt)
• Development Environment: VS Code (folder .vscode) for possible debugging or workspace settings.