Closed sambhavnoobcoder closed 3 months ago
LGTM but seems there is a lot of duplicate code
so far we are working on only shell scripts since Bash scripting is a subset of shell scripting . So most of the common bash commands would easily on the shell implementation itself , without any difference to the expected behaviour . Also , since shell is almost entirely compliant with the POSIX standards and bash is also nearly fully POSIX compliant ( bash version 4.0 and later have been made fully POSIX compliant) so we only have a very few scripts that might give error to the above implementation(Only a smaller niche of commands that may not have been upgraded , deprecations , etc .) . Hence I would suggest , that we could solve this with a simple try - catch statement , so that in case a command execution fails with the shell , it is then given to the bash implementation , and if that fails , it is concluded to be in an incorrect format . Considering the size of/ number of edge cases expected here Is small , I would think this to very feasible as well .
If you think this is a valid solution , I'll start coding it out , else if you have any other suggestion , I'd be glad to give that approach a look as well .
Alr if so I would like to add the bash commands to the list too
Description
This PR addresses issue #35 by implementing a new 'run' command in the Pieces CLI that allows users to directly execute their saved bash snippets in the terminal.
Problem:
Users want a quick way to execute their saved bash snippets without having to manually copy and paste them into the terminal.
Solution:
We've implemented a new ExecuteCommand class that allows users to execute a snippet by its name directly from the Pieces CLI. This is achieved through two new files: run_shell_command.py and run_bash_command.py.
Changes:
run_shell_command.py (new file):
run_bash_command.py (new file):
Key features:
Implementation details: