From 465d6c506f68a33e97e31b68dfa10bdc457b14e0 Mon Sep 17 00:00:00 2001 From: tongjingran Date: Mon, 19 Jul 2021 16:31:42 +0800 Subject: [PATCH] cmdLine will return file with args --- cmd/list.go | 2 +- pkg/client/client.go | 1 + pkg/cover/agent.tpl | 2 +- pkg/cover/agentwatch.tpl | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/list.go b/cmd/list.go index 38451cf..1fb5bec 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -21,7 +21,7 @@ var listWide bool func init() { listCmd.Flags().StringVar(&config.GocConfig.Host, "host", "127.0.0.1:7777", "specify the host of the goc server") - listCmd.Flags().BoolVar(&listWide, "wide", false, "List all services with more information (such as pid)") + listCmd.Flags().BoolVar(&listWide, "wide", false, "list all services with more information (such as pid)") rootCmd.AddCommand(listCmd) } diff --git a/pkg/client/client.go b/pkg/client/client.go index 2d1fac3..0a39272 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -82,6 +82,7 @@ func (c *client) ListAgents(wide bool) { table.SetNoWhiteSpace(true) table.SetReflowDuringAutoWrap(false) table.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + table.SetAutoWrapText(false) if wide { table.SetHeader([]string{"ID", "REMOTEIP", "HOSTNAME", "PID", "CMD"}) table.SetColumnAlignment([]int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT}) diff --git a/pkg/cover/agent.tpl b/pkg/cover/agent.tpl index 64d32aa..fa70c6a 100644 --- a/pkg/cover/agent.tpl +++ b/pkg/cover/agent.tpl @@ -204,7 +204,7 @@ func getRegisterInfo() (*processInfo, error) { pid := os.Getpid() - cmdline := os.Args[0] + cmdline := strings.Join(os.Args, " ") return &processInfo{ hostname: hostname, diff --git a/pkg/cover/agentwatch.tpl b/pkg/cover/agentwatch.tpl index c0ddc89..69191c8 100644 --- a/pkg/cover/agentwatch.tpl +++ b/pkg/cover/agentwatch.tpl @@ -6,6 +6,7 @@ import ( "os" "log" "strconv" + "strings" "net/url" "{{.GlobalCoverVarImportPath}}/websocket" @@ -115,7 +116,7 @@ func getRegisterInfo() (*processInfo, error) { pid := os.Getpid() - cmdline := os.Args[0] + cmdline := strings.Join(os.Args, " ") return &processInfo{ hostname: hostname,