import { UserInputUtil , IBlockchainQuickPickItem } from './UserInputUtil' ; import { FeatureFlagManager , IFeatureFlag } from '../util/FeatureFlags' ; export async function manageFeatureFlags ( ) { const items = [ ] ; for ( const flag of FeatureFlagManager . ALL ) { const enabled = await FeatureFlagManager . enabled ( flag ) ; items . push ( { data : flag , label : flag . getName ( ) , description : flag . getDescription ( ) , picked : enabled } ) ; } const result = ( await UserInputUtil . showQuickPickItem < IFeatureFlag > ( 'Enable or disable experimental features' , items , true ) ) as IBlockchainQuickPickItem < IFeatureFlag > [ ] ; if ( result === undefined ) { return ; } for ( const flag of FeatureFlagManager . ALL ) { let enabled = false ; for ( const item of result ) { if ( flag === item . data ) { enabled = true ; } } if ( enabled ) { await FeatureFlagManager . enable ( flag ) ; } else { await FeatureFlagManager . disable ( flag ) ; } } }