Compare commits
2 Commits
8896cb7d09
...
1ff37517a5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ff37517a5 | ||
|
|
c7fceb277d |
@@ -126,21 +126,36 @@ 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 {
|
||||
fmt.Print("> ")
|
||||
var command string
|
||||
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
command, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if len(commands) <= 0 {
|
||||
fmt.Print("> ")
|
||||
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user