Skip to content

Commit 654a5c6

Browse files
author
Luca Bianconi
committed
style: renamed options
1 parent 4d68aae commit 654a5c6

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Diff for: internal/cli/compile/compile.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ type showPropertiesMode int
4848

4949
const (
5050
showPropertiesModeDisabled showPropertiesMode = iota
51-
showPropertiesModePattern
52-
showPropertiesModeValue
51+
showPropertiesModeUnexpanded
52+
showPropertiesModeExpanded
5353
)
5454

5555
func parseShowPropertiesMode(showProperties string) (showPropertiesMode, error) {
5656
val, ok := map[string]showPropertiesMode{
57-
"disabled": showPropertiesModeDisabled,
58-
"pattern": showPropertiesModePattern,
59-
"value": showPropertiesModeValue,
57+
"disabled": showPropertiesModeDisabled,
58+
"unexpanded": showPropertiesModeUnexpanded,
59+
"expanded": showPropertiesModeExpanded,
6060
}[showProperties]
6161
if !ok {
6262
return showPropertiesModeDisabled, fmt.Errorf(tr("invalid option '%s'.", showProperties))
@@ -120,9 +120,9 @@ func NewCommand() *cobra.Command {
120120
&showProperties,
121121
"show-properties",
122122
"disabled",
123-
tr(`Show build properties instead of compiling. With "pattern" properties are returned as they are defined. If "value" the placeholders are replaced with compilation context values.`),
123+
tr(`Show build properties instead of compiling. With "expanded" the placeholders are replaced with compilation context values.`),
124124
)
125-
compileCommand.Flags().Lookup("show-properties").NoOptDefVal = "pattern" // default if the flag is present with no value
125+
compileCommand.Flags().Lookup("show-properties").NoOptDefVal = "unexpanded" // default if the flag is present with no value
126126
compileCommand.Flags().BoolVar(&preprocess, "preprocess", false, tr("Print preprocessed code to stdout instead of compiling."))
127127
compileCommand.Flags().StringVar(&buildCachePath, "build-cache-path", "", tr("Builds of 'core.a' are saved into this path to be cached and reused."))
128128
compileCommand.Flags().StringVarP(&exportDir, "output-dir", "", "", tr("Save build artifacts in this directory."))
@@ -385,7 +385,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
385385
}
386386
feedback.FatalResult(res, feedback.ErrGeneric)
387387
}
388-
if showPropertiesM == showPropertiesModeValue {
388+
if showPropertiesM == showPropertiesModeExpanded {
389389
expandPropertiesInResult(res)
390390
}
391391
feedback.PrintResult(res)

Diff for: internal/integrationtest/compile_3/compile_show_properties_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ func TestCompileShowProperties(t *testing.T) {
7474
require.Empty(t, stderr)
7575
requireCompileResponseJson(t, stdout)
7676

77-
// Test --show-properties=pattern output is clean
77+
// Test --show-properties=unexpanded output is clean
7878
// properties are not expanded
79-
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=pattern", bareMinimum.String())
79+
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=unexpanded", bareMinimum.String())
8080
require.NoError(t, err)
8181
props, err = properties.LoadFromBytes(stdout)
8282
require.NoError(t, err, "Output must be a clean property list")
8383
require.Empty(t, stderr)
8484
require.True(t, props.ContainsKey("archive_file_path"))
8585
require.Contains(t, props.Get("archive_file_path"), "{build.path}")
8686

87-
// Test --show-properties=pattern output is clean
87+
// Test --show-properties=unexpanded output is clean
8888
// properties are not expanded
89-
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=pattern", "--format", "json", bareMinimum.String())
89+
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=unexpanded", "--format", "json", bareMinimum.String())
9090
require.NoError(t, err)
9191
require.Empty(t, stderr)
9292
props, err = properties.LoadFromSlice(
@@ -95,19 +95,19 @@ func TestCompileShowProperties(t *testing.T) {
9595
require.True(t, props.ContainsKey("archive_file_path"))
9696
require.Contains(t, props.Get("archive_file_path"), "{build.path}")
9797

98-
// Test --show-properties=value output is clean
98+
// Test --show-properties=expanded output is clean
9999
// properties are expanded
100-
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=value", bareMinimum.String())
100+
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=expanded", bareMinimum.String())
101101
require.NoError(t, err)
102102
props, err = properties.LoadFromBytes(stdout)
103103
require.NoError(t, err, "Output must be a clean property list")
104104
require.Empty(t, stderr)
105105
require.True(t, props.ContainsKey("archive_file_path"))
106106
require.NotContains(t, props.Get("archive_file_path"), "{build.path}")
107107

108-
// Test --show-properties=value --format JSON output is clean
108+
// Test --show-properties=expanded --format JSON output is clean
109109
// properties are expanded
110-
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=value", "--format", "json", bareMinimum.String())
110+
stdout, stderr, err = cli.Run("compile", "--fqbn", "arduino:avr:uno", "-v", "--show-properties=expanded", "--format", "json", bareMinimum.String())
111111
require.NoError(t, err)
112112
require.Empty(t, stderr)
113113
props, err = properties.LoadFromSlice(

0 commit comments

Comments
 (0)