mirror of
https://github.com/docker/compose.git
synced 2025-07-23 21:54:40 +02:00
Collect metrics --help flag
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
aa09ecb1f8
commit
c1fe338ac7
@ -18,7 +18,7 @@ package metrics
|
|||||||
|
|
||||||
var commandFlags = []string{
|
var commandFlags = []string{
|
||||||
//added to catch scan details
|
//added to catch scan details
|
||||||
"--version", "--login",
|
"--version", "--login", "--help",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generated with generatecommands/main.go
|
// Generated with generatecommands/main.go
|
||||||
|
@ -51,9 +51,6 @@ func GetCommand(args []string) string {
|
|||||||
result := ""
|
result := ""
|
||||||
onlyFlags := false
|
onlyFlags := false
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
if arg == "--help" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if arg == "--" {
|
if arg == "--" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -63,7 +60,7 @@ func GetCommand(args []string) string {
|
|||||||
} else {
|
} else {
|
||||||
result = result + " " + arg
|
result = result + " " + arg
|
||||||
}
|
}
|
||||||
if !isManagementCommand(arg) {
|
if isCommand(arg) && !isManagementCommand(arg) {
|
||||||
onlyFlags = true
|
onlyFlags = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,26 +153,26 @@ func TestGetCommand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIgnoreHelpCommands(t *testing.T) {
|
func TestKeepHelpCommands(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "help",
|
name: "run with help flag",
|
||||||
args: []string{"--help"},
|
|
||||||
expected: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "help on run",
|
|
||||||
args: []string{"run", "--help"},
|
args: []string{"run", "--help"},
|
||||||
expected: "",
|
expected: "run --help",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "help on compose up",
|
name: "with help flag before-after commands",
|
||||||
args: []string{"compose", "up", "--help"},
|
args: []string{"compose", "--help", "up"},
|
||||||
expected: "",
|
expected: "compose --help up",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "help flag",
|
||||||
|
args: []string{"--help"},
|
||||||
|
expected: "--help",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user