fix: more robust <app> autocomplete + error handling

See toolshed/organising#652
This commit is contained in:
2024-12-28 22:22:13 +01:00
parent 8ac31330be
commit fab93a559a
6 changed files with 38 additions and 32 deletions

View File

@ -2,6 +2,7 @@ package app
import (
"context"
"fmt"
"io"
"os"
"slices"
@ -37,8 +38,8 @@ var AppLogsCommand = &cobra.Command{
case 1:
app, err := appPkg.Get(args[0])
if err != nil {
log.Debugf("autocomplete failed: %s", err)
return nil, cobra.ShellCompDirectiveDefault
errMsg := fmt.Sprintf("autocomplete failed: %s", err)
return []string{errMsg}, cobra.ShellCompDirectiveError
}
return autocomplete.ServiceNameComplete(app.Name)
default: