Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmd/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func init() {

invocationHistoryCmd.Flags().Int("limit", 100, "Max invocations to return (default 100)")
invocationHistoryCmd.Flags().StringP("app", "a", "", "Filter by app name")
invocationHistoryCmd.Flags().String("version", "", "Filter by invocation version")
invokeCmd.AddCommand(invocationHistoryCmd)
}

Expand Down Expand Up @@ -209,6 +210,7 @@ func runInvocationHistory(cmd *cobra.Command, args []string) error {

lim, _ := cmd.Flags().GetInt("limit")
appFilter, _ := cmd.Flags().GetString("app")
versionFilter, _ := cmd.Flags().GetString("version")

// Build parameters for the API call
params := kernel.InvocationListParams{
Expand All @@ -218,7 +220,20 @@ func runInvocationHistory(cmd *cobra.Command, args []string) error {
// Only add app filter if specified
if appFilter != "" {
params.AppName = kernel.Opt(appFilter)
}

// Only add version filter if specified
if versionFilter != "" {
params.Version = kernel.Opt(versionFilter)
}

// Build debug message based on filters
if appFilter != "" && versionFilter != "" {
pterm.Debug.Printf("Listing invocations for app '%s' version '%s'...\n", appFilter, versionFilter)
} else if appFilter != "" {
pterm.Debug.Printf("Listing invocations for app '%s'...\n", appFilter)
} else if versionFilter != "" {
pterm.Debug.Printf("Listing invocations for version '%s'...\n", versionFilter)
} else {
pterm.Debug.Printf("Listing all invocations...\n")
}
Expand All @@ -230,7 +245,7 @@ func runInvocationHistory(cmd *cobra.Command, args []string) error {
return nil
}

table := pterm.TableData{{"Invocation ID", "App Name", "Action", "Status", "Started At", "Duration", "Output"}}
table := pterm.TableData{{"Invocation ID", "App Name", "Action", "Version", "Status", "Started At", "Duration", "Output"}}

for _, inv := range invocations.Items {
started := util.FormatLocal(inv.StartedAt)
Expand Down Expand Up @@ -261,6 +276,7 @@ func runInvocationHistory(cmd *cobra.Command, args []string) error {
inv.ID,
inv.AppName,
inv.ActionName,
inv.Version,
status,
started,
duration,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/charmbracelet/fang v0.2.0
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/joho/godotenv v1.5.1
github.com/onkernel/kernel-go-sdk v0.11.4
github.com/onkernel/kernel-go-sdk v0.11.5
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/pterm/pterm v0.12.80
github.com/samber/lo v1.51.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWe
github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0=
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
github.com/onkernel/kernel-go-sdk v0.11.4 h1:vgDcPtldfEcRh+a1wlOSOY2bBWjxLFUwHqeXHHQ4OjM=
github.com/onkernel/kernel-go-sdk v0.11.4/go.mod h1:MjUR92i8UPqjrmneyVykae6GuB3GGSmnQtnjf1v74Dc=
github.com/onkernel/kernel-go-sdk v0.11.5 h1:LApX5A/Ful62LwNTW+srhi/3cx3W04pzgZ361PlDEAc=
github.com/onkernel/kernel-go-sdk v0.11.5/go.mod h1:MjUR92i8UPqjrmneyVykae6GuB3GGSmnQtnjf1v74Dc=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down