shell setup

This commit is contained in:
Hazel Noack
2025-10-08 10:27:16 +02:00
parent 183b03ee64
commit 8587bdf360
6 changed files with 262 additions and 29 deletions

View File

@@ -1,7 +1,11 @@
package common
import (
"bufio"
"errors"
"fmt"
"log"
"os"
"strings"
)
@@ -116,3 +120,26 @@ func NewQuery(search string) (Query, error) {
return query, nil
}
func TestQueryParsing() {
for {
fmt.Print("> ")
reader := bufio.NewReader(os.Stdin)
line, err := reader.ReadString('\n')
if err != nil {
log.Fatal(err)
return
}
query, err := NewQuery(line)
if err != nil {
fmt.Println(err)
}
fmt.Println("search: '" + query.Search + "'")
fmt.Println("artist: '" + query.Artist + "'")
fmt.Println("album: '" + query.Album + "'")
fmt.Println("song: '" + query.Song + "'")
fmt.Println()
}
}