From 0ce0dd5d0c52b646d895b82c77aa00ebf25af8b7 Mon Sep 17 00:00:00 2001 From: Fabien Taillon Date: Thu, 8 Sep 2022 14:31:09 +0200 Subject: [PATCH] Added texei:picklist:create command --- README.md | 70 ++++++++++----- messages/picklist-create.json | 8 ++ package.json | 2 +- src/commands/texei/picklist/create.ts | 120 ++++++++++++++++++++++++++ 4 files changed, 178 insertions(+), 22 deletions(-) create mode 100644 messages/picklist-create.json create mode 100644 src/commands/texei/picklist/create.ts diff --git a/README.md b/README.md index 06ba67c..1ef7644 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Link the plugin: sfdx plugins:link . * [`sfdx texei:org:contractfieldhistory:fix [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiorgcontractfieldhistoryfix--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:org:shape:extract [-d ] [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiorgshapeextract--d-string--s-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipackagedependenciesinstall--k-string--b-string--p-string--s-string--n-string--w-number--r--a-string--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) +* [`sfdx texei:picklist:create -d -o -a -l [-t ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipicklistcreate--d-string--o-string--a-string--l-string--t-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:picklist:restrict -d [-o] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipicklistrestrict--d-string--o--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:picklist:unrestrict [-o] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipicklistunrestrict--o--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:profile:clean [-k ] [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiprofileclean--k-string--p-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) @@ -77,7 +78,7 @@ EXAMPLE --targetusername texei ``` -_See code: [src/commands/texei/contractstatus/value/add.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/contractstatus/value/add.ts)_ +_See code: [src/commands/texei/contractstatus/value/add.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/contractstatus/value/add.ts)_ ## `sfdx texei:cpqsettings:set -f [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -106,7 +107,7 @@ EXAMPLE sfdx texei:cpqsettings:set ``` -_See code: [src/commands/texei/cpqsettings/set.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/cpqsettings/set.ts)_ +_See code: [src/commands/texei/cpqsettings/set.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/cpqsettings/set.ts)_ ## `sfdx texei:data:export -d [-o ] [-p ] [-a ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -144,7 +145,7 @@ EXAMPLES sfdx texei:data:export --dataplan ./data/data-plan.json --outputdir ./data --targetusername texei ``` -_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/data/export.ts)_ +_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/data/export.ts)_ ## `sfdx texei:data:import -d [-a] [-o] [-p ] [-i] [-u ] [--apiversion ] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -190,7 +191,7 @@ EXAMPLE Data imported! ``` -_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/data/import.ts)_ +_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/data/import.ts)_ ## `sfdx texei:data:plan:generate -d -o [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -217,7 +218,7 @@ EXAMPLE $ sfdx texei:data:plan:generate --objects Account,Contact,MyCustomObject__c --outputdir ./data ``` -_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/data/plan/generate.ts)_ +_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/data/plan/generate.ts)_ ## `sfdx texei:debug:lwc:enable [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -244,7 +245,7 @@ EXAMPLE sfdx texei:debug:lwc:enable --targetusername myOrg@example.com ``` -_See code: [src/commands/texei/debug/lwc/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/debug/lwc/enable.ts)_ +_See code: [src/commands/texei/debug/lwc/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/debug/lwc/enable.ts)_ ## `sfdx texei:org:contractfieldhistory:fix [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -272,7 +273,7 @@ EXAMPLE History tracking fixed. ``` -_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/org/contractfieldhistory/fix.ts)_ +_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/org/contractfieldhistory/fix.ts)_ ## `sfdx texei:org:shape:extract [-d ] [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -307,7 +308,7 @@ EXAMPLE $ sfdx texei:org:shape:extract -u bulma@capsulecorp.com ``` -_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/org/shape/extract.ts)_ +_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/org/shape/extract.ts)_ ## `sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -370,7 +371,34 @@ EXAMPLE $ texei:package:dependencies:install -u MyScratchOrg -v MyDevHub -k "1:MyPackage1Key 2: 3:MyPackage3Key" -b "DEV" ``` -_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/package/dependencies/install.ts)_ +_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/package/dependencies/install.ts)_ + +## `sfdx texei:picklist:create -d -o -a -l [-t ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` + +create a picklist metadata file from a csv file (apiname;label) + +``` +USAGE + $ sfdx texei:picklist:create -d -o -a -l [-t ] [--json] [--loglevel + trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] + +OPTIONS + -a, --apiname=apiname (required) Field API Name + -d, --inputdir=inputdir (required) path to csv file + -l, --label=label (required) Field Label + -o, --outputdir=outputdir (required) path where to save file + -t, --type=Picklist|MultiselectPicklist [default: Picklist] Field Type + --json format output as json + + --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for + this command invocation + +EXAMPLE + sfdx texei:picklist:create --inputdir ./my-file.csv --outputdir ./force-app/main/default/objects/Opportunity/fields + --label "My Field" --apiname MyField__c +``` + +_See code: [src/commands/texei/picklist/create.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/picklist/create.ts)_ ## `sfdx texei:picklist:restrict -d [-o] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -405,7 +433,7 @@ EXAMPLE $ sfdx texei:picklist:restrict -d my-unrestricted-picklists.json ``` -_See code: [src/commands/texei/picklist/restrict.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/picklist/restrict.ts)_ +_See code: [src/commands/texei/picklist/restrict.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/picklist/restrict.ts)_ ## `sfdx texei:picklist:unrestrict [-o] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -436,7 +464,7 @@ EXAMPLES $ sfdx texei:picklist:unrestrict --json > my-unrestricted-picklists.json ``` -_See code: [src/commands/texei/picklist/unrestrict.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/picklist/unrestrict.ts)_ +_See code: [src/commands/texei/picklist/unrestrict.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/picklist/unrestrict.ts)_ ## `sfdx texei:profile:clean [-k ] [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -469,7 +497,7 @@ EXAMPLES custom-sfdx-source-folder/main/profiles,source-folder-2/main/profiles/myAdmin.profile-meta.xml ``` -_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/profile/clean.ts)_ +_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/profile/clean.ts)_ ## `sfdx texei:sharedactivities:enable [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -496,7 +524,7 @@ EXAMPLE $ sfdx texei:sharedactivities:enable ``` -_See code: [src/commands/texei/sharedactivities/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/sharedactivities/enable.ts)_ +_See code: [src/commands/texei/sharedactivities/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/sharedactivities/enable.ts)_ ## `sfdx texei:sharingcalc:recalculate [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -527,7 +555,7 @@ EXAMPLE Recalculated Sharing Rules ``` -_See code: [src/commands/texei/sharingcalc/recalculate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/sharingcalc/recalculate.ts)_ +_See code: [src/commands/texei/sharingcalc/recalculate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/sharingcalc/recalculate.ts)_ ## `sfdx texei:sharingcalc:resume [-s ] [-t ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -561,7 +589,7 @@ EXAMPLE Sharing calculations resumed ``` -_See code: [src/commands/texei/sharingcalc/resume.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/sharingcalc/resume.ts)_ +_See code: [src/commands/texei/sharingcalc/resume.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/sharingcalc/resume.ts)_ ## `sfdx texei:sharingcalc:suspend [-s ] [-t ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -595,7 +623,7 @@ EXAMPLE Sharing calculations suspended ``` -_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/sharingcalc/suspend.ts)_ +_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/sharingcalc/suspend.ts)_ ## `sfdx texei:skinnyprofile:check [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -619,7 +647,7 @@ EXAMPLE $ texei:skinnyprofile:check ``` -_See code: [src/commands/texei/skinnyprofile/check.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/skinnyprofile/check.ts)_ +_See code: [src/commands/texei/skinnyprofile/check.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/skinnyprofile/check.ts)_ ## `sfdx texei:skinnyprofile:retrieve [-t ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -649,7 +677,7 @@ EXAMPLE $ texei:skinnyprofile:retrieve -u MyScratchOrg ``` -_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/skinnyprofile/retrieve.ts)_ +_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/skinnyprofile/retrieve.ts)_ ## `sfdx texei:source:customlabel:replace -l -v [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -673,7 +701,7 @@ EXAMPLE $ texei:source:customlabel:replace --label GreatSalesforceBlog --value https://blog.texei.com ``` -_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/source/customlabel/replace.ts)_ +_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/source/customlabel/replace.ts)_ ## `sfdx texei:source:layouts:cleanorg [-p ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -706,7 +734,7 @@ EXAMPLES $ texei:source:layouts:cleanorg --targetusername myScratchOrg --targetdevhubusername myDevHub ``` -_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/source/layouts/cleanorg.ts)_ +_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/source/layouts/cleanorg.ts)_ ## `sfdx texei:user:update [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -739,5 +767,5 @@ EXAMPLES sfdx texei:user:update --values "LanguageLocaleKey=en_US UserPermissionsMarketingUser=true" --json ``` -_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.16.5/src/commands/texei/user/update.ts)_ +_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.17.0/src/commands/texei/user/update.ts)_ diff --git a/messages/picklist-create.json b/messages/picklist-create.json new file mode 100644 index 0000000..a54cb3c --- /dev/null +++ b/messages/picklist-create.json @@ -0,0 +1,8 @@ +{ + "commandDescription": "create a picklist metadata file from a csv file (apiname;label)", + "inputFlagDescription": "path to csv file", + "outputFlagDescription": "path where to save file", + "apiNameFlagDescription": "Field API Name", + "labelFlagDescription": "Field Label", + "typeFlagDescription": "Field Type" +} \ No newline at end of file diff --git a/package.json b/package.json index 3a2f536..d02b055 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "texei-sfdx-plugin", "description": "Texeï's plugin for sfdx", - "version": "1.16.5", + "version": "1.17.0", "author": "Texeï", "bugs": "https://github.com/https://github.com/texei/texei-sfdx-plugin/issues", "dependencies": { diff --git a/src/commands/texei/picklist/create.ts b/src/commands/texei/picklist/create.ts new file mode 100644 index 0000000..327c57c --- /dev/null +++ b/src/commands/texei/picklist/create.ts @@ -0,0 +1,120 @@ +import { flags, SfdxCommand } from '@salesforce/command'; +import { Messages } from '@salesforce/core'; +import { AnyJson } from '@salesforce/ts-types'; +import { promises as fs } from 'fs'; +import * as path from "path"; +const xml2js = require('xml2js'); + +// Initialize Messages with the current plugin directory +Messages.importMessagesDirectory(__dirname); + +// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core, +// or any library that is using the messages framework can also be loaded this way. +const messages = Messages.loadMessages('texei-sfdx-plugin', 'picklist-create'); + +export default class Restrict extends SfdxCommand { + + public static description = messages.getMessage('commandDescription'); + + public static examples = [ + `sfdx texei:picklist:create --inputdir ./my-file.csv --outputdir ./force-app/main/default/objects/Opportunity/fields --label "My Field" --apiname MyField__c` + ]; + + protected static flagsConfig = { + inputdir: flags.string({ + char: "d", + description: messages.getMessage("inputFlagDescription"), + required: true + }), + outputdir: flags.string({ + char: "o", + description: messages.getMessage("outputFlagDescription"), + required: true + }), + apiname: flags.string({ + char: "a", + description: messages.getMessage("apiNameFlagDescription"), + required: true + }), + label: flags.string({ + char: "l", + description: messages.getMessage("labelFlagDescription"), + required: true + }), + type: flags.string({ + char: "t", + description: messages.getMessage("typeFlagDescription"), + options: ['Picklist', 'MultiselectPicklist'], + default: 'Picklist', + required: false + }) + }; + + // Comment this out if your command does not require an org username + protected static requiresUsername = false; + + // Comment this out if your command does not support a hub org username + protected static requiresDevhubUsername = false; + + // Set this to true if your command requires a project workspace; 'requiresProject' is false by default + protected static requiresProject = false; + + public async run(): Promise { + + const inputFilePath = path.join(process.cwd(), this.flags.inputdir); + const outputFilePath = path.join(process.cwd(), this.flags.outputdir, `${this.flags.apiname}.field-meta.xml`); + const fileData = await fs.readFile(inputFilePath, 'utf8'); + + let picklistValueSet:AnyJson = {}; + picklistValueSet.valueSet = {}; + picklistValueSet.valueSet.restricted = true; + picklistValueSet.valueSet.valueSetDefinition = {}; + picklistValueSet.valueSet.valueSetDefinition.sorted = false; + picklistValueSet.valueSet.valueSetDefinition.value = []; + + for (const line of fileData.split('\r\n')) { + + const lineValues = line.split(';'); + + // Skipping empty line (like ending line) + if (lineValues[0] != '') { + let picklistVal:AnyJson = {}; + picklistVal.fullName = await this.cleanData(lineValues[0]); + picklistVal.default = false; + picklistVal.label = await this.cleanData(lineValues[1]); + picklistValueSet.valueSet.valueSetDefinition.value.push(picklistVal); + } + } + + let metadataFile:AnyJson = { + 'CustomField': { + $: { xmlns: 'http://soap.sforce.com/2006/04/metadata' }, + fullName: this.flags.apiname, + externalId: false, + label: this.flags.label, + required: false, + trackFeedHistory: false, + trackTrending: false, + type: this.flags.type, + valueSet: picklistValueSet.valueSet, + visibleLines: 4 + } + }; + + // Building back as an xml + const builder = new xml2js.Builder(); + var xmlFile = builder.buildObject(metadataFile); + + // Writing back to file + await fs.writeFile(outputFilePath, xmlFile, 'utf8'); + + return {}; + } + + private async cleanData(value: string):Promise { + if (value.charAt(0) === `"` && value.charAt(value.length-1) === `"`) { + value = value.substring(1, value.length-1); + } + return value; + } +} \ No newline at end of file