@@ -19,210 +19,206 @@ process.on('unhandledRejection', (reason, p) => {
1919 process . exit ( 1 ) ;
2020} ) ;
2121
22- new LaunchDarklyUtils ( ) . create ( process . env . LAUNCHDARKLY_API_TOKEN , log ) . then ( function ( ldUtils ) {
22+ new LaunchDarklyUtils ( ) . create ( process . env . LAUNCHDARKLY_API_TOKEN , log ) . then ( ldUtils => {
2323 program . version ( '1.0.0' ) . description ( 'Manage LaunchDarkly flags and other assets from the command line.' ) ;
2424
2525 program
2626 . command ( 'getFeatureFlags <projectKey>' )
2727 . description ( 'get all flags for a given project' )
28- . action ( function ( projectKey ) {
29- ldUtils . flags . getFeatureFlags ( projectKey ) . then ( function ( response ) {
28+ . action ( projectKey => {
29+ ldUtils . flags . getFeatureFlags ( projectKey ) . then ( response => {
3030 console . log ( json . plain ( response ) ) ;
3131 } ) ;
3232 } ) ;
3333
3434 program
3535 . command ( `getFeatureFlag <projectKey> <featureFlagKey> [environmentKeyQuery]` )
3636 . description ( 'get a single flag - with optional env' )
37- . action ( function ( projectKey , featureFlagKey , environmentKeyQuery ) {
38- ldUtils . flags . getFeatureFlag ( projectKey , featureFlagKey , environmentKeyQuery ) . then ( function ( response ) {
37+ . action ( ( projectKey , featureFlagKey , environmentKeyQuery ) => {
38+ ldUtils . flags . getFeatureFlag ( projectKey , featureFlagKey , environmentKeyQuery ) . then ( response => {
3939 console . log ( json . plain ( response ) ) ;
4040 } ) ;
4141 } ) ;
4242
4343 program
4444 . command ( `getFeatureFlagState <projectKey> <featureFlagKey> <environmentKeyQuery>` )
4545 . description ( 'get boolean flag state' )
46- . action ( function ( projectKey , featureFlagKey , environmentKeyQuery ) {
47- ldUtils . flags
48- . getFeatureFlagState ( projectKey , featureFlagKey , environmentKeyQuery )
49- . then ( function ( response ) {
50- console . log ( json . plain ( response ) ) ;
51- } ) ;
46+ . action ( ( projectKey , featureFlagKey , environmentKeyQuery ) => {
47+ ldUtils . flags . getFeatureFlagState ( projectKey , featureFlagKey , environmentKeyQuery ) . then ( response => {
48+ console . log ( json . plain ( response ) ) ;
49+ } ) ;
5250 } ) ;
5351
5452 program
5553 . command ( `toggleFeatureFlag <projectKey> <featureFlagKey> <environmentKeyQuery> <value>` )
5654 . description ( 'set boolean flag state' )
57- . action ( function ( projectKey , featureFlagKey , environmentKeyQuery , value ) {
55+ . action ( ( projectKey , featureFlagKey , environmentKeyQuery , value ) => {
5856 let enabled = value === 'true' ;
59- ldUtils . flags
60- . toggleFeatureFlag ( projectKey , featureFlagKey , environmentKeyQuery , enabled )
61- . then ( function ( response ) {
62- console . log ( json . plain ( response ) ) ;
63- } ) ;
57+ ldUtils . flags . toggleFeatureFlag ( projectKey , featureFlagKey , environmentKeyQuery , enabled ) . then ( response => {
58+ console . log ( json . plain ( response ) ) ;
59+ } ) ;
6460 } ) ;
6561
6662 program
6763 . command ( `migrateFeatureFlag <projectKey> <featureFlagKey> <fromEnv> <toEnv> (includeState)` )
6864 . description ( 'migrate flag settings from one environment to another' )
69- . action ( function ( projectKey , featureFlagKey , fromEnv , toEnv , includeState ) {
65+ . action ( ( projectKey , featureFlagKey , fromEnv , toEnv , includeState ) => {
7066 ldUtils . flags
7167 . migrateFeatureFlag ( projectKey , featureFlagKey , fromEnv , toEnv , includeState )
72- . then ( function ( response ) {
68+ . then ( response => {
7369 console . log ( json . plain ( response ) ) ;
7470 } ) ;
7571 } ) ;
7672
7773 program
7874 . command ( `bulkMigrateFeatureFlags <projectKey> <featureFlagKeys> <fromEnv> <toEnv> (includeState)` )
7975 . description ( 'migrate multiple flag settings from one environment to another' )
80- . action ( function ( projectKey , featureFlagKeys , fromEnv , toEnv , includeState ) {
76+ . action ( ( projectKey , featureFlagKeys , fromEnv , toEnv , includeState ) => {
8177 ldUtils . flags
8278 . bulkMigrateFeatureFlags ( projectKey , featureFlagKeys , fromEnv , toEnv , includeState )
83- . then ( function ( response ) {
79+ . then ( response => {
8480 console . log ( json . plain ( response ) ) ;
8581 } ) ;
8682 } ) ;
8783
8884 program
8985 . command ( `restoreFeatureFlags <projectKey> <featureFlagKeys> <targetEnv> <backupJsonFile> (includeState)` )
9086 . description ( 'restore environment flag settings from a backup file - backup from getFeatureFlags' )
91- . action ( function ( projectKey , featureFlagKeys , targetEnv , backupJsonFile , includeState ) {
87+ . action ( ( projectKey , featureFlagKeys , targetEnv , backupJsonFile , includeState ) => {
9288 ldUtils . flags
9389 . restoreFeatureFlags ( projectKey , featureFlagKeys , targetEnv , backupJsonFile , includeState )
94- . then ( function ( response ) {
90+ . then ( response => {
9591 console . log ( json . plain ( response ) ) ;
9692 } ) ;
9793 } ) ;
9894
9995 program
10096 . command ( 'getCustomRoles' )
10197 . description ( 'get all custom roles in account' )
102- . action ( function ( ) {
103- ldUtils . roles . getCustomRoles ( ) . then ( function ( response ) {
98+ . action ( ( ) => {
99+ ldUtils . roles . getCustomRoles ( ) . then ( response => {
104100 console . log ( json . plain ( response ) ) ;
105101 } ) ;
106102 } ) ;
107103
108104 program
109105 . command ( 'getCustomRole <customRoleKey>' )
110106 . description ( 'get custom role by key' )
111- . action ( function ( customRoleKey ) {
112- ldUtils . roles . getCustomRole ( customRoleKey ) . then ( function ( response ) {
107+ . action ( customRoleKey => {
108+ ldUtils . roles . getCustomRole ( customRoleKey ) . then ( response => {
113109 console . log ( json . plain ( response ) ) ;
114110 } ) ;
115111 } ) ;
116112
117113 program
118114 . command ( 'getCustomRoleById <customRoleId>' )
119115 . description ( 'get custom role by id' )
120- . action ( function ( customRoleId ) {
121- ldUtils . roles . getCustomRoleById ( customRoleId ) . then ( function ( response ) {
116+ . action ( customRoleId => {
117+ ldUtils . roles . getCustomRoleById ( customRoleId ) . then ( response => {
122118 console . log ( json . plain ( response ) ) ;
123119 } ) ;
124120 } ) ;
125121
126122 program
127123 . command ( `createCustomRole <customRoleKey> <customRoleName> <customRolePolicyArray> [customRoleDescription]` )
128124 . description ( 'create custom role' )
129- . action ( function ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) {
125+ . action ( ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) => {
130126 customRolePolicyArray = JSON . parse ( customRolePolicyArray ) ;
131127 ldUtils . roles
132128 . createCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription )
133- . then ( function ( response ) {
129+ . then ( response => {
134130 console . log ( json . plain ( response ) ) ;
135131 } ) ;
136132 } ) ;
137133
138134 program
139135 . command ( `updateCustomRole <customRoleKey> <customRoleName> <customRolePolicyArray> [customRoleDescription]` )
140136 . description ( 'update custom role' )
141- . action ( function ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) {
137+ . action ( ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) => {
142138 customRolePolicyArray = JSON . parse ( customRolePolicyArray ) ;
143139 ldUtils . roles
144140 . updateCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription )
145- . then ( function ( response ) {
141+ . then ( response => {
146142 console . log ( json . plain ( response ) ) ;
147143 } ) ;
148144 } ) ;
149145
150146 program
151147 . command ( `upsertCustomRole <customRoleKey> <customRoleName> <customRolePolicyArray> [customRoleDescription]` )
152148 . description ( 'create or update custom role' )
153- . action ( function ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) {
149+ . action ( ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) => {
154150 customRolePolicyArray = JSON . parse ( customRolePolicyArray ) ;
155151 ldUtils . roles
156152 . upsertCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription )
157- . then ( function ( response ) {
153+ . then ( response => {
158154 console . log ( json . plain ( response ) ) ;
159155 } ) ;
160156 } ) ;
161157
162158 program
163159 . command ( 'bulkUpsertCustomRoles <roleBulkLoadFile>' )
164160 . description ( 'path to a file containing array of role json' )
165- . action ( function ( roleBulkLoadFile ) {
166- ldUtils . roles . bulkUpsertCustomRoles ( roleBulkLoadFile ) . then ( function ( response ) {
161+ . action ( roleBulkLoadFile => {
162+ ldUtils . roles . bulkUpsertCustomRoles ( roleBulkLoadFile ) . then ( response => {
167163 console . log ( json . plain ( response ) ) ;
168164 } ) ;
169165 } ) ;
170166
171167 program
172168 . command ( 'bulkUpsertCustomRoleFolder <roleFolder>' )
173169 . description ( 'path to a directory containing multiple files of role json' )
174- . action ( function ( roleFolder ) {
175- ldUtils . roles . bulkUpsertCustomRoleFolder ( roleFolder ) . then ( function ( response ) {
170+ . action ( roleFolder => {
171+ ldUtils . roles . bulkUpsertCustomRoleFolder ( roleFolder ) . then ( response => {
176172 console . log ( json . plain ( response ) ) ;
177173 } ) ;
178174 } ) ;
179175
180176 program
181177 . command ( 'inviteTeamMember <emailAddress> <initialRoleName>' )
182178 . description ( 'Invite a New Team Member' )
183- . action ( function ( emailAddress , initialRoleName ) {
184- ldUtils . members . inviteTeamMember ( emailAddress , initialRoleName ) . then ( function ( response ) {
179+ . action ( ( emailAddress , initialRoleName ) => {
180+ ldUtils . members . inviteTeamMember ( emailAddress , initialRoleName ) . then ( response => {
185181 console . log ( json . plain ( response ) ) ;
186182 } ) ;
187183 } ) ;
188184
189185 program
190186 . command ( 'getTeamMembers [limit] [offset] [filter]' )
191187 . description ( 'list all team members in account' )
192- . action ( function ( limit , offset , filter ) {
193- ldUtils . members . getTeamMembers ( limit , offset , filter ) . then ( function ( response ) {
188+ . action ( ( limit , offset , filter ) => {
189+ ldUtils . members . getTeamMembers ( limit , offset , filter ) . then ( response => {
194190 console . log ( json . plain ( response ) ) ;
195191 } ) ;
196192 } ) ;
197193
198194 program
199195 . command ( 'getTeamMember <memberId>' )
200196 . description ( 'get a team member by id' )
201- . action ( function ( memberId ) {
202- ldUtils . members . getTeamMember ( memberId ) . then ( function ( response ) {
197+ . action ( memberId => {
198+ ldUtils . members . getTeamMember ( memberId ) . then ( response => {
203199 console . log ( json . plain ( response ) ) ;
204200 } ) ;
205201 } ) ;
206202
207203 program
208204 . command ( 'getTeamMemberByEmail <emailAddress>' )
209205 . description ( 'get a team member by email address' )
210- . action ( function ( emailAddress ) {
211- ldUtils . members . getTeamMemberByEmail ( emailAddress ) . then ( function ( response ) {
206+ . action ( emailAddress => {
207+ ldUtils . members . getTeamMemberByEmail ( emailAddress ) . then ( response => {
212208 console . log ( json . plain ( response ) ) ;
213209 } ) ;
214210 } ) ;
215211
216212 program
217213 . command ( 'getTeamMemberCustomRoles <emailAddress>' )
218214 . description ( 'get a team members custom roles by email address' )
219- . action ( function ( emailAddress ) {
220- ldUtils . members . getTeamMemberCustomRoles ( emailAddress ) . then ( function ( response ) {
215+ . action ( emailAddress => {
216+ ldUtils . members . getTeamMemberCustomRoles ( emailAddress ) . then ( response => {
221217 console . log ( json . plain ( response ) ) ;
222218 } ) ;
223219 } ) ;
224220
225- program . on ( '--help' , function ( ) {
221+ program . on ( '--help' , ( ) => {
226222 console . log ( '\n See https://github.com/zotoio/launchdarkly-nodeutils/API.md for examples.\n' ) ;
227223 } ) ;
228224
0 commit comments