Skip to content

Commit c04db26

Browse files
fix(export): align label separator default (comma) with other commands
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
1 parent c9e2eff commit c04db26

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

cmd/werf/common/common.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ Format: annoName=annoValue[<separator>annoName=annoValue ...]. The default separ
419419
Also, can be specified with $WERF_ADD_ANNOTATION_* (e.g. $WERF_ADD_ANNOTATION_1=annoName1=annoValue1, $WERF_ADD_ANNOTATION_2=annoName2=annoValue2)`, DefaultPairSeparator))
420420
}
421421

422-
const DefaultAnnoAndLabelPairSeparator = "\n"
423-
424422
func SetupAddAnnotationSeparator(cmdData *CmdData, cmd *cobra.Command) {
425423
cmdData.AddAnnotationSeparator = new(string)
426424

cmd/werf/export/export.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,16 @@ func NewExportCmd(ctx context.Context) *cobra.Command {
128128
cmd.Flags().StringArrayVarP(&tagTemplateList, "tag", "", []string{}, `Set a tag template (can specify multiple).
129129
It is necessary to use image name shortcut %image% or %image_slug% if multiple images are exported (e.g. REPO:TAG-%image% or REPO-%image%:TAG)`)
130130

131-
cmd.Flags().StringArrayVarP(&addLabelArray, "add-label", "", []string{}, `Add label to exported images (can specify multiple).
132-
Format: labelName=labelValue[<separator>labelName=labelValue ...]. The default separator is a newline ("\n"), but it can be customized using the --add-label-separator flag.
133-
Also, can be specified with $WERF_EXPORT_ADD_LABEL_* (e.g. $WERF_EXPORT_ADD_LABEL_1=labelName1=labelValue1, $WERF_EXPORT_ADD_LABEL_2=labelName2=labelValue2)`)
131+
cmd.Flags().StringArrayVarP(&addLabelArray, "add-label", "", []string{}, fmt.Sprintf(`Add label to exported images (can specify multiple).
132+
Format: labelName=labelValue[<separator>labelName=labelValue ...]. The default separator is a newline %q, but it can be customized using the --add-label-separator flag.
133+
Also, can be specified with $WERF_EXPORT_ADD_LABEL_* (e.g. $WERF_EXPORT_ADD_LABEL_1=labelName1=labelValue1, $WERF_EXPORT_ADD_LABEL_2=labelName2=labelValue2)`, common.DefaultPairSeparator))
134134

135-
defaultValue := common.DefaultAnnoAndLabelPairSeparator
135+
defaultValue := common.DefaultPairSeparator
136136
if os.Getenv("WERF_EXPORT_ADD_LABEL_SEPARATOR") != "" {
137137
defaultValue = os.Getenv("WERF_EXPORT_ADD_LABEL_SEPARATOR")
138138
}
139139

140-
cmd.Flags().StringVarP(&addLabelSeparator, "add-label-separator", "", defaultValue, `Separator for --add-label values (default $WERF_EXPORT_ADD_LABEL_SEPARATOR or "\n")`)
140+
cmd.Flags().StringVarP(&addLabelSeparator, "add-label-separator", "", defaultValue, fmt.Sprintf(`Separator for --add-label values (default $WERF_EXPORT_ADD_LABEL_SEPARATOR or %q)`, common.DefaultPairSeparator))
141141

142142
commonCmdData.SetupSkipImageSpecStage(cmd)
143143

docs/_includes/reference/cli/werf_export.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ werf export [IMAGE_NAME...] [options]
3838
--add-label=[]
3939
Add label to exported images (can specify multiple).
4040
Format: labelName=labelValue[<separator>labelName=labelValue ...]. The default
41-
separator is a newline ("\n"), but it can be customized using the --add-label-separator
41+
separator is a newline ",", but it can be customized using the --add-label-separator
4242
flag.
4343
Also, can be specified with $WERF_EXPORT_ADD_LABEL_* (e.g.
4444
$WERF_EXPORT_ADD_LABEL_1=labelName1=labelValue1,
4545
$WERF_EXPORT_ADD_LABEL_2=labelName2=labelValue2)
46-
--add-label-separator="\n"
47-
Separator for --add-label values (default $WERF_EXPORT_ADD_LABEL_SEPARATOR or "\n")
46+
--add-label-separator=","
47+
Separator for --add-label values (default $WERF_EXPORT_ADD_LABEL_SEPARATOR or ",")
4848
--cache-repo=[]
4949
Specify one or multiple cache repos with images that will be used as a cache. Cache
5050
will be populated when pushing newly built images into the primary repo and when

0 commit comments

Comments
 (0)