github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/client/cmd_ctl_logrotate.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package client 5 6 import ( 7 "github.com/keybase/cli" 8 "github.com/keybase/client/go/libcmdline" 9 "github.com/keybase/client/go/libkb" 10 "golang.org/x/net/context" 11 ) 12 13 func NewCmdCtlLogRotate(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command { 14 return cli.Command{ 15 Name: "log-rotate", 16 Usage: "Close and open the keybase service's log file", 17 Action: func(c *cli.Context) { 18 cl.ChooseCommand(&CmdCtlLogRotate{libkb.NewContextified(g)}, "log-rotate", c) 19 cl.SetForkCmd(libcmdline.NoFork) 20 cl.SetNoStandalone() 21 }, 22 } 23 } 24 25 type CmdCtlLogRotate struct { 26 libkb.Contextified 27 } 28 29 func (s *CmdCtlLogRotate) ParseArgv(ctx *cli.Context) error { 30 return nil 31 } 32 33 func (s *CmdCtlLogRotate) Run() (err error) { 34 cli, err := GetCtlClient(s.G()) 35 if err != nil { 36 return err 37 } 38 return cli.LogRotate(context.TODO(), 0) 39 } 40 41 func (s *CmdCtlLogRotate) GetUsage() libkb.Usage { 42 return libkb.Usage{} 43 }