diff --git a/main.go b/main.go index 39222f4..d9123a0 100644 --- a/main.go +++ b/main.go @@ -152,7 +152,7 @@ func validateOptions(opts *options) error { } } if !isValidColors { - return fmt.Errorf("FlameGraph unknown colors %q. Valid ones are %v", opts.OutputOpts.Colors, validColors) + return fmt.Errorf("FlameGraph unknown colors %q. Valid ones are: %s", opts.OutputOpts.Colors, strings.Join(validColors, ", ")) } } @@ -178,7 +178,7 @@ func buildFlameGraphArgs(opts outputOptions) []string { args = append(args, "--hash") } - if opts.ColorPalette { + if opts.ConsistentPalette { args = append(args, "--cp") } diff --git a/main_test.go b/main_test.go index 39d1bd7..c6f1079 100644 --- a/main_test.go +++ b/main_test.go @@ -91,11 +91,11 @@ func TestInvalidOptions(t *testing.T) { }, { args: []string{"--width", "10"}, - errorMessage: "FlameGraph miminal graph with is 1 200 pixels", + errorMessage: "FlameGraph miminal graph width is 1200 pixels", }, { args: []string{"--colors", "foo"}, - errorMessage: "FlameGraph unknown colors 'foo'", + errorMessage: "FlameGraph unknown colors \"foo\". Valid ones are: hot, mem, io, wakeup, chain, java, js, perl, red, green, blue, aqua, yellow, purple, orange", }, } @@ -127,11 +127,11 @@ func TestFlameGraphArgs(t *testing.T) { opts.OutputOpts.Hash = true opts.OutputOpts.Colors = "perl" - opts.OutputOpts.ColorPalette = true + opts.OutputOpts.ConsistentPalette = true opts.OutputOpts.Reverse = true opts.OutputOpts.Inverted = true - expectedCommandWithArgs := []string{"--title", "Flame Graph", "--width", "1900", "--colors", "perl", + expectedCommandWithArgs := []string{"--title", "Flame Graph", "--width", "1200", "--colors", "perl", "--hash", "--cp", "--reverse", "--inverted"} if !reflect.DeepEqual(expectedCommandWithArgs, buildFlameGraphArgs(opts.OutputOpts)) {