add comments to the repl package

This commit is contained in:
Robin Olsen
2026-02-08 12:56:09 +01:00
parent 38faee631f
commit 3bf80ba859
6 changed files with 68 additions and 18 deletions

View File

@@ -7,6 +7,9 @@ import (
"github.com/LazyBachelor/LazyPM/pkg/cli/commands"
)
// execute processes the input command and returns the output
// or an error if it occurs. It handles what type of command is being executed,
// whether it's a PM command or a shell command, and routes it accordingly.
func execute(input string) (string, error) {
if input == "" {
return "", nil
@@ -26,6 +29,8 @@ func execute(input string) (string, error) {
return executeShellCommand(input)
}
// executeShellCommand executes a shell command
// and returns its output or an error if it occurs.
func executeShellCommand(input string) (string, error) {
parts := strings.Fields(input)
if len(parts) == 0 {
@@ -37,6 +42,8 @@ func executeShellCommand(input string) (string, error) {
return string(output), err
}
// executePMCommand executes a PM command using the commands package
// and returns its output or an error if it occurs.
func executePMCommand(input string) (string, error) {
parts := strings.Fields(input)
if len(parts) == 0 {