goc/cmd/watch.go

42 lines
1.1 KiB
Go
Raw Normal View History

2021-09-02 09:48:11 +00:00
/*
Copyright 2021 Qiniu Cloud (qiniu.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2021-06-24 09:28:44 +00:00
package cmd
import (
2024-11-19 03:32:10 +00:00
cli "github.com/ar0c/goc/v2/pkg/watch"
"github.com/spf13/cobra"
2021-06-24 09:28:44 +00:00
)
var watchCmd = &cobra.Command{
2024-11-19 03:32:10 +00:00
Use: "watch",
Short: "watch for profile's real time update",
Long: "watch for profile's real time update",
Example: "",
2021-06-24 09:28:44 +00:00
2024-11-19 03:32:10 +00:00
Run: watch,
2021-06-24 09:28:44 +00:00
}
var (
2024-11-19 03:32:10 +00:00
watchHost string
)
2021-06-24 09:28:44 +00:00
func init() {
2024-11-19 03:32:10 +00:00
watchCmd.Flags().StringVarP(&watchHost, "host", "", "127.0.0.1:7777", "specify the host of the goc server")
rootCmd.AddCommand(watchCmd)
2021-06-24 09:28:44 +00:00
}
func watch(cmd *cobra.Command, args []string) {
2024-11-19 03:32:10 +00:00
cli.Watch(watchHost)
2021-06-24 09:28:44 +00:00
}