Skip to content

Commit b431724

Browse files
committed
chore(workflow-cli): remove apps logs
1 parent 485fb7a commit b431724

4 files changed

Lines changed: 3 additions & 69 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24
55
require (
66
github.com/chai2010/gettext-go v1.0.3
77
github.com/containerd/console v1.0.4
8-
github.com/drycc/controller-sdk-go v0.0.0-20250326034724-1dafccaadf6b
8+
github.com/drycc/controller-sdk-go v0.0.0-20250625050826-8be5432737be
99
github.com/drycc/pkg v0.0.0-20241223062248-04810c5faa4b
1010
github.com/minio/selfupdate v0.6.0
1111
github.com/olekukonko/tablewriter v0.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
1111
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1212
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
1313
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14-
github.com/drycc/controller-sdk-go v0.0.0-20250326034724-1dafccaadf6b h1:IA4sT1t/x/JtUm6F6T7j66ETAXwikYaUuNoQMmVp5ew=
15-
github.com/drycc/controller-sdk-go v0.0.0-20250326034724-1dafccaadf6b/go.mod h1:m4nhGeLJvR9bWuF12XhJ1c+hvkVY27OPN48F3l+AvAI=
14+
github.com/drycc/controller-sdk-go v0.0.0-20250625050826-8be5432737be h1:aIdgIpvYa6SuPQIV3C3UKNItMaTK3YDxP0sRlfrYSUE=
15+
github.com/drycc/controller-sdk-go v0.0.0-20250625050826-8be5432737be/go.mod h1:MbFxGlgRQUaVlThbn3DmB06EJsf+e3/O+qgbWmdvtoE=
1616
github.com/drycc/pkg v0.0.0-20241223062248-04810c5faa4b h1:wSIZheOVyeakCpI1i6xDta9e5YLZgNCqw7JfxC6R5MA=
1717
github.com/drycc/pkg v0.0.0-20241223062248-04810c5faa4b/go.mod h1:upGcZF/RCEqidGjSnWHh/txRC1I4GPsRGvF8/+bDfwU=
1818
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=

internal/commands/apps.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,18 @@ package commands
22

33
import (
44
"fmt"
5-
"io"
6-
"log"
7-
"os"
85
"regexp"
96
"strings"
107
"time"
118

12-
"github.com/drycc/controller-sdk-go/api"
139
"github.com/drycc/controller-sdk-go/apps"
1410
"github.com/drycc/controller-sdk-go/appsettings"
1511
"github.com/drycc/controller-sdk-go/domains"
1612
"github.com/drycc/controller-sdk-go/ps"
1713
"github.com/drycc/workflow-cli/internal/utils"
1814
"github.com/drycc/workflow-cli/pkg/git"
19-
"github.com/drycc/workflow-cli/pkg/logging"
2015
"github.com/drycc/workflow-cli/pkg/settings"
2116
"github.com/drycc/workflow-cli/pkg/webbrowser"
22-
"golang.org/x/net/websocket"
2317
)
2418

2519
// AppCreate creates an app.
@@ -205,37 +199,6 @@ func (d *DryccCmd) AppOpen(appID string) error {
205199
return webbrowser.Webbrowser(u)
206200
}
207201

208-
// AppLogs returns the logs from an app.
209-
func (d *DryccCmd) AppLogs(appID string, lines int, follow bool, timeout int) error {
210-
appID, s, err := utils.LoadAppSettings(d.ConfigFile, appID)
211-
212-
if err != nil {
213-
return err
214-
}
215-
request := api.AppLogsRequest{
216-
Lines: lines,
217-
Follow: follow,
218-
Timeout: timeout,
219-
}
220-
conn, err := apps.Logs(s.Client, appID, request)
221-
if err != nil {
222-
return err
223-
}
224-
defer conn.Close()
225-
for {
226-
var message string
227-
err := websocket.Message.Receive(conn, &message)
228-
if err != nil {
229-
if err != io.EOF {
230-
log.Printf("error: %v", err)
231-
}
232-
break
233-
}
234-
logging.PrintLog(os.Stdout, strings.TrimRight(string(message), "\n"))
235-
}
236-
return nil
237-
}
238-
239202
// AppRun runs a one time command in the app.
240203
func (d *DryccCmd) AppRun(appID, command string, volumeVars []string, timeout, expires uint32) error {
241204
appID, s, err := utils.LoadAppSettings(d.ConfigFile, appID)

internal/parser/apps.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func NewAppsCommand(cmdr *commands.DryccCmd) *cobra.Command {
2525
cmd.AddCommand(appsList(cmdr))
2626
cmd.AddCommand(appsInfo(cmdr))
2727
cmd.AddCommand(appsOpen(cmdr))
28-
cmd.AddCommand(appsLogs(cmdr))
2928
cmd.AddCommand(appsRun(cmdr))
3029
cmd.AddCommand(appsDestroy(cmdr))
3130
cmd.AddCommand(appsTransfer(cmdr))
@@ -111,34 +110,6 @@ func appsOpen(cmdr *commands.DryccCmd) *cobra.Command {
111110
return cmd
112111
}
113112

114-
// AppsLogs creates the apps logs command
115-
func appsLogs(cmdr *commands.DryccCmd) *cobra.Command {
116-
var flags struct {
117-
app string
118-
lines int
119-
follow bool
120-
timeout int
121-
}
122-
123-
cmd := &cobra.Command{
124-
Use: "logs",
125-
Short: i18n.T("Retrieve application log events"),
126-
Long: i18n.T("Retrieves the most recent log events"),
127-
RunE: func(_ *cobra.Command, _ []string) error {
128-
return cmdr.AppLogs(app, flags.lines, flags.follow, flags.timeout)
129-
},
130-
}
131-
132-
cmd.Flags().StringVarP(&app, "app", "a", "", i18n.T("The uniquely identifiable name for the application"))
133-
cmd.Flags().IntVarP(&flags.lines, "lines", "n", 300, i18n.T("The number of lines to display"))
134-
cmd.Flags().BoolVarP(&flags.follow, "follow", "f", false, i18n.T("Specify if the logs should be streamed"))
135-
cmd.Flags().IntVarP(&flags.timeout, "timeout", "t", 300, i18n.T("The max seconds of followz the log stream"))
136-
137-
appCompletion := completion.AppCompletion{ArgsLen: -1, ConfigFile: &cmdr.ConfigFile}
138-
cmd.RegisterFlagCompletionFunc("app", appCompletion.CompletionFunc)
139-
return cmd
140-
}
141-
142113
// AppsRun creates the apps run command
143114
func appsRun(cmdr *commands.DryccCmd) *cobra.Command {
144115
var flags struct {

0 commit comments

Comments
 (0)