Skip to content

Commit 0c2a90f

Browse files
committed
Make cog build logs follow by default
This is a user's intention when using the command. They might want to not follow if it's a long-running process or they are using it in a script. The former is not the case with builds and the latter they can use the flag. Signed-off-by: Ben Firshman <ben@firshman.co.uk>
1 parent 5ea2ce1 commit 0c2a90f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

pkg/cli/build.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"github.com/replicate/cog/pkg/util/console"
99
)
1010

11+
var buildNoFollow bool
12+
1113
func newBuildCommand() *cobra.Command {
1214
cmd := &cobra.Command{
1315
Use: "build",
@@ -30,26 +32,23 @@ func newBuildLogCommand() *cobra.Command {
3032

3133
addModelFlag(cmd)
3234

33-
cmd.Flags().BoolP("follow", "f", false, "Follow streaming logs")
35+
cmd.Flags().BoolVarP(&buildNoFollow, "no-follow", "", false, "Exit immediately instead of waiting until output finishes")
3436
// TODO(andreas): tail
3537

3638
return cmd
3739
}
3840

3941
func showBuildLogs(cmd *cobra.Command, args []string) error {
4042
buildID := args[0]
41-
follow, err := cmd.Flags().GetBool("follow")
42-
if err != nil {
43-
return err
44-
}
4543

4644
model, err := getModel()
4745
if err != nil {
4846
return err
4947
}
5048

5149
c := client.NewClient()
52-
logChan, err := c.GetBuildLogs(model, buildID, follow)
50+
// FIXME(bfirsh): why isn't this a logger.Logger?
51+
logChan, err := c.GetBuildLogs(model, buildID, !buildNoFollow)
5352
if err != nil {
5453
return err
5554
}

0 commit comments

Comments
 (0)