@@ -15,15 +15,12 @@ let log = console;
1515if ( process . env . LAUNCHDARKLY_API_LOGLEVEL === 'debug' ) log = undefined ;
1616
1717process . on ( 'unhandledRejection' , ( reason , p ) => {
18- console . error ( json . plain ( { " error" : reason } ) ) ;
18+ console . error ( json . plain ( { error : reason } ) ) ;
1919 process . exit ( 1 ) ;
2020} ) ;
2121
2222new LaunchDarklyUtils ( ) . create ( process . env . LAUNCHDARKLY_API_TOKEN , log ) . then ( function ( ldUtils ) {
23-
24- program
25- . version ( '1.0.0' )
26- . description ( 'Manage LaunchDarkly flags and other assets from the command line.' ) ;
23+ program . version ( '1.0.0' ) . description ( 'Manage LaunchDarkly flags and other assets from the command line.' ) ;
2724
2825 program
2926 . command ( 'getFeatureFlags <projectKey>' )
@@ -57,36 +54,44 @@ new LaunchDarklyUtils().create(process.env.LAUNCHDARKLY_API_TOKEN, log).then(fun
5754 . description ( 'set boolean flag state' )
5855 . action ( function ( projectKey , featureFlagKey , environmentKeyQuery , value ) {
5956 let enabled = value === 'true' ;
60- ldUtils . flags . toggleFeatureFlag ( projectKey , featureFlagKey , environmentKeyQuery , enabled ) . then ( function ( response ) {
61- console . log ( json . plain ( response ) ) ;
62- } ) ;
57+ ldUtils . flags
58+ . toggleFeatureFlag ( projectKey , featureFlagKey , environmentKeyQuery , enabled )
59+ . then ( function ( response ) {
60+ console . log ( json . plain ( response ) ) ;
61+ } ) ;
6362 } ) ;
6463
6564 program
6665 . command ( `migrateFeatureFlag <projectKey> <featureFlagKey> <fromEnv> <toEnv> (includeState)` )
6766 . description ( 'migrate flag settings from one environment to another' )
6867 . action ( function ( projectKey , featureFlagKey , fromEnv , toEnv , includeState ) {
69- ldUtils . flags . migrateFeatureFlag ( projectKey , featureFlagKey , fromEnv , toEnv , includeState ) . then ( function ( response ) {
70- console . log ( json . plain ( response ) ) ;
71- } ) ;
68+ ldUtils . flags
69+ . migrateFeatureFlag ( projectKey , featureFlagKey , fromEnv , toEnv , includeState )
70+ . then ( function ( response ) {
71+ console . log ( json . plain ( response ) ) ;
72+ } ) ;
7273 } ) ;
7374
7475 program
7576 . command ( `bulkMigrateFeatureFlags <projectKey> <featureFlagKeys> <fromEnv> <toEnv> (includeState)` )
7677 . description ( 'migrate multiple flag settings from one environment to another' )
7778 . action ( function ( projectKey , featureFlagKeys , fromEnv , toEnv , includeState ) {
78- ldUtils . flags . bulkMigrateFeatureFlags ( projectKey , featureFlagKeys , fromEnv , toEnv , includeState ) . then ( function ( response ) {
79- console . log ( json . plain ( response ) ) ;
80- } ) ;
79+ ldUtils . flags
80+ . bulkMigrateFeatureFlags ( projectKey , featureFlagKeys , fromEnv , toEnv , includeState )
81+ . then ( function ( response ) {
82+ console . log ( json . plain ( response ) ) ;
83+ } ) ;
8184 } ) ;
8285
8386 program
8487 . command ( `restoreFeatureFlags <projectKey> <featureFlagKeys> <targetEnv> <backupJsonFile> (includeState)` )
8588 . description ( 'restore environment flag settings from a backup file - backup from getFeatureFlags' )
8689 . action ( function ( projectKey , featureFlagKeys , targetEnv , backupJsonFile , includeState ) {
87- ldUtils . flags . restoreFeatureFlags ( projectKey , featureFlagKeys , targetEnv , backupJsonFile , includeState ) . then ( function ( response ) {
88- console . log ( json . plain ( response ) ) ;
89- } ) ;
90+ ldUtils . flags
91+ . restoreFeatureFlags ( projectKey , featureFlagKeys , targetEnv , backupJsonFile , includeState )
92+ . then ( function ( response ) {
93+ console . log ( json . plain ( response ) ) ;
94+ } ) ;
9095 } ) ;
9196
9297 program
@@ -121,29 +126,35 @@ new LaunchDarklyUtils().create(process.env.LAUNCHDARKLY_API_TOKEN, log).then(fun
121126 . description ( 'create custom role' )
122127 . action ( function ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) {
123128 customRolePolicyArray = JSON . parse ( customRolePolicyArray ) ;
124- ldUtils . roles . createCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) . then ( function ( response ) {
125- console . log ( json . plain ( response ) ) ;
126- } ) ;
129+ ldUtils . roles
130+ . createCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription )
131+ . then ( function ( response ) {
132+ console . log ( json . plain ( response ) ) ;
133+ } ) ;
127134 } ) ;
128135
129136 program
130137 . command ( `updateCustomRole <customRoleKey> <customRoleName> <customRolePolicyArray> [customRoleDescription]` )
131138 . description ( 'update custom role' )
132139 . action ( function ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) {
133140 customRolePolicyArray = JSON . parse ( customRolePolicyArray ) ;
134- ldUtils . roles . updateCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) . then ( function ( response ) {
135- console . log ( json . plain ( response ) ) ;
136- } ) ;
141+ ldUtils . roles
142+ . updateCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription )
143+ . then ( function ( response ) {
144+ console . log ( json . plain ( response ) ) ;
145+ } ) ;
137146 } ) ;
138147
139148 program
140149 . command ( `upsertCustomRole <customRoleKey> <customRoleName> <customRolePolicyArray> [customRoleDescription]` )
141150 . description ( 'create or update custom role' )
142151 . action ( function ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) {
143152 customRolePolicyArray = JSON . parse ( customRolePolicyArray ) ;
144- ldUtils . roles . upsertCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription ) . then ( function ( response ) {
145- console . log ( json . plain ( response ) ) ;
146- } ) ;
153+ ldUtils . roles
154+ . upsertCustomRole ( customRoleKey , customRoleName , customRolePolicyArray , customRoleDescription )
155+ . then ( function ( response ) {
156+ console . log ( json . plain ( response ) ) ;
157+ } ) ;
147158 } ) ;
148159
149160 program
@@ -218,8 +229,5 @@ new LaunchDarklyUtils().create(process.env.LAUNCHDARKLY_API_TOKEN, log).then(fun
218229 process . exit ( 1 ) ;
219230 }
220231
221- program
222- . parse ( process . argv ) ;
223-
232+ program . parse ( process . argv ) ;
224233} ) ;
225-
0 commit comments