Skip to content

Commit 167f890

Browse files
committed
improve app list output and pagination handling
1 parent f66cb26 commit 167f890

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

cmd/app.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ func init() {
4040
// Add optional filters for list
4141
appListCmd.Flags().String("name", "", "Filter by application name")
4242
appListCmd.Flags().String("version", "", "Filter by version label")
43+
appListCmd.Flags().Int("limit", 20, "Max apps to return (default 20)")
4344

4445
// Limit rows returned for app history (0 = all)
45-
appHistoryCmd.Flags().Int("limit", 100, "Max deployments to return (default 100)")
46+
appHistoryCmd.Flags().Int("limit", 20, "Max deployments to return (default 20)")
4647
}
4748

4849
func runAppList(cmd *cobra.Command, args []string) error {
4950
client := getKernelClient(cmd)
5051
appName, _ := cmd.Flags().GetString("name")
5152
version, _ := cmd.Flags().GetString("version")
53+
lim, _ := cmd.Flags().GetInt("limit")
5254

5355
pterm.Debug.Println("Fetching deployed applications...")
5456

@@ -76,6 +78,7 @@ func runAppList(cmd *cobra.Command, args []string) error {
7678
{"App Name", "Version", "App Version ID", "Region", "Actions", "Env Vars"},
7779
}
7880

81+
rows := 0
7982
for _, app := range *apps {
8083
// Format env vars
8184
envVarsStr := "-"
@@ -98,6 +101,10 @@ func runAppList(cmd *cobra.Command, args []string) error {
98101
actionsStr,
99102
envVarsStr,
100103
})
104+
rows++
105+
if lim > 0 && rows >= lim {
106+
break
107+
}
101108
}
102109

103110
PrintTableNoPad(tableData, true)

cmd/deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func init() {
6363
deployLogsCmd.Flags().BoolP("with-timestamps", "t", false, "Include timestamps in each log line")
6464
deployCmd.AddCommand(deployLogsCmd)
6565

66-
deployHistoryCmd.Flags().Int("limit", 100, "Max deployments to return (default 100)")
66+
deployHistoryCmd.Flags().Int("limit", 20, "Max deployments to return (default 20)")
6767
deployCmd.AddCommand(deployHistoryCmd)
6868

6969
// Flags for GitHub deploy

0 commit comments

Comments
 (0)