Compare commits

..

2 Commits

Author SHA1 Message Date
acute_interpreter_panic
1ff37517a5 test 2025-10-10 13:21:04 +02:00
acute_interpreter_panic
c7fceb277d added running of commands 2025-10-10 13:19:32 +02:00
2 changed files with 25 additions and 7 deletions

View File

@@ -126,22 +126,37 @@ func interpretCommand(command string, store musicObjectStore) (musicObjectStore,
return append(store, currentMusicObjects), nil
}
func Shell() {
func Shell(commandsList ...[]string) {
plugin.RegisterPlugin(&plugin.Musify{})
commands := []string{}
if len(commandsList) > 0 {
commands = commandsList[0]
}
fmt.Println("== MusicKraken Shell ==")
fmt.Println()
store := musicObjectStore{}
var err error = nil
for {
var command string
if len(commands) <= 0 {
fmt.Print("> ")
reader := bufio.NewReader(os.Stdin)
command, err := reader.ReadString('\n')
command, err = reader.ReadString('\n')
if err != nil {
log.Fatal(err)
}
} else {
command = commands[0]
commands = commands[1:]
fmt.Println("> " + command)
}
store, err = interpretCommand(strings.TrimSpace(command), store)
if err != nil {

View File

@@ -5,5 +5,8 @@ import (
)
func main() {
cli.Shell()
cli.Shell([]string{
"#a Crystal F",
"20",
})
}