Bugfix: Display selected card when inserting
This commit is contained in:
parent
b2946d00e2
commit
2ecb448e29
|
@ -71,8 +71,9 @@ func MainCliLoop(db *sql.DB) {
|
||||||
|
|
||||||
var previousCardPrintingId = cardLocation.CardPrintingId
|
var previousCardPrintingId = cardLocation.CardPrintingId
|
||||||
|
|
||||||
pk, err := logic.GenericSearch(insertSearchOptions)
|
pk, searchLine, err := logic.GenericSearch(insertSearchOptions)
|
||||||
cardLocation.CardPrintingId = pk
|
cardLocation.CardPrintingId = pk
|
||||||
|
selectedCardPrintingSearchLine = searchLine
|
||||||
|
|
||||||
var exitError *exec.ExitError
|
var exitError *exec.ExitError
|
||||||
if errors.As(err, &exitError) {
|
if errors.As(err, &exitError) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ func GetAllSearchOptions(db *sql.DB, searchCriteria SearchCriteria) (InsertSearc
|
||||||
return searchOptions, err
|
return searchOptions, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenericSearch[pk string | int](options map[string]pk) (pk, error) {
|
func GenericSearch[pk string | int](options map[string]pk) (pk, string, error) {
|
||||||
var value pk
|
var value pk
|
||||||
|
|
||||||
cmd := exec.Command("fzf")
|
cmd := exec.Command("fzf")
|
||||||
|
@ -69,7 +69,7 @@ func GenericSearch[pk string | int](options map[string]pk) (pk, error) {
|
||||||
|
|
||||||
fzfStdin, err := cmd.StdinPipe()
|
fzfStdin, err := cmd.StdinPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return value, err
|
return value, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -81,10 +81,10 @@ func GenericSearch[pk string | int](options map[string]pk) (pk, error) {
|
||||||
|
|
||||||
fzfOutput, err := cmd.Output()
|
fzfOutput, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return value, err
|
return value, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResult := strings.TrimSuffix(string(fzfOutput), "\n")
|
searchResult := strings.TrimSuffix(string(fzfOutput), "\n")
|
||||||
value = options[searchResult]
|
value = options[searchResult]
|
||||||
return value, nil
|
return value, searchResult, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue