Option Sets¶
The CLI can help you manage option sets by downloading, iterating, and uploading option sets via CSV and YAML.
Download All Option Sets¶
To download all option sets for a specific organization, use getOptionSets
like below.
contrail types getOptionSets --format <YAML or CSV>
Upload Option Sets¶
To load multiple option sets YML files from a folder, use uploadOptionSets
. This will update existing option sets if they exist and create new ones if they're not already in the system.
contrail types uploadOptionSets <Directory Path>
Merge Option Sets¶
To combine the option sets from an existing organization with the OptionSets in a file, use this command. The option sets file must be a .yml file. This will combine the option sets in the YML file with the ones already in the system and give you a single YML file with all of them.
Run this CLI command
contrail types mergeOptionSets <File Path>
Parse Option Sets Local File¶
To parse CSV files into OptionSets, you can use the parseOptionSetsLocalFiles
command.
The style
parameter specifies the format of the CSV file, which can be either "NameAndLabelAndKey"
or "LabelsInColumn"
.
If the CSV file has separate columns for option set name, option key, and option label, you should use the "NameAndLabelAndKey" style.
Example file for NameAndLabelAndKey would be
Gender,g_men,Men
Bender,g_women,Women
Gender,g_uni,Unisex
Countries,co_spain,Spain
Countries,co_france,France
Countries,co_aus,Australia
Countries,co_usa,United States of America,
Countries,co_egypt,Egypt
If the CSV file has one column for each option set, with the rows representing the label values, you should use the "LabelsInColumn" style. In this case, the option keys will be automatically generated.
Example file for LabelsInColumn would be
Gender,Countries,Brands
men,spain,prada
women,france,converse
unisex,australia
,usa
,egypt
Run this CLI command
contrail types parseOptionSetsLocalFiles <File Path> <style>