This class represents settings for an Imperative CLI application that can be configured by an end user by modifying a settings file. Settings are stored in {@link AppSettings#settings} in a format specified by ISettingsFile.

### Hierarchy

- AppSettings

## Index

### Constructors

- constructor

### Properties

- persistence
- settings
- mInstance

### Accessors

- initialized
- instance

### Methods

- flush
- get
- getNamespace
- getSettings
- set
- initialize

## Constructors

### constructor

- new AppSettings(persistence: ISettingsFilePersistence, initial: ISettingsFile): AppSettings

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:85

  Constructs a new settings object

  #### Parameters

  - ##### persistence: ISettingsFilePersistence

  - ##### initial: ISettingsFile

    Initial settings object

  #### Returns AppSettings

## Properties

### Private Readonly persistence

persistence: ISettingsFilePersistence

- Defined in @zowe/imperative/src/settings/src/AppSettings.ts:85

### Private Readonly settings

settings: ISettingsFile

- Defined in @zowe/imperative/src/settings/src/AppSettings.ts:84

The settings loaded from the file specified in the constructor.

### Static Private mInstance

mInstance: AppSettings

- Defined in @zowe/imperative/src/settings/src/AppSettings.ts:80

This is an internal reference to the static settings instance.

## Accessors

### Static initialized

- get initialized(): boolean

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:121

  #### Returns boolean

  true if the app settings have been initialized

### Static instance

- get instance(): AppSettings

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:107

  Get the singleton instance of the app settings object that was initialized within the AppSettings.initialize function.

  throws

    SettingsNotInitialized When the settings singleton has not been initialized.

  #### Returns AppSettings

  A singleton AppSettings object

## Methods

### Private flush

- flush(): void

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:176

  Writes settings to the file

  #### Returns void

### get

- get(namespace: keyof ISettingsFile, key: string): SettingValue

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:150

  Get a value of settings option

  #### Parameters

  - ##### namespace: keyof ISettingsFile

    ISettingsFile

  - ##### key: string

    Name of a setting option to set

  #### Returns SettingValue

### getNamespace

- getNamespace(namespace: keyof ISettingsFile): Record<string, unknown> | OverrideSettings

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:162

  Get a member of ISettingsFile of specified namespace

  #### Parameters

  - ##### namespace: keyof ISettingsFile

  #### Returns Record<string, unknown> | OverrideSettings

### getSettings

- getSettings(): ISettingsFile

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:169

  Get settings

  #### Returns ISettingsFile

### set

- set(namespace: keyof ISettingsFile, key: string, value: SettingValue): void

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:131

  Set a settings option and save it to the settings file.

  #### Parameters

  - ##### namespace: keyof ISettingsFile

    ISettingsFile

  - ##### key: string

    Name of a setting option to set

  - ##### value: SettingValue

  #### Returns void

### Static initialize

- initialize(settingsFile: string, defaults: ISettingsFile): AppSettings

- - Defined in @zowe/imperative/src/settings/src/AppSettings.ts:35

  Initialize

  #### Parameters

  - ##### settingsFile: string

    The settings file to load from

  - ##### defaults: ISettingsFile

    ISettingsFile Settings with default values

  #### Returns AppSettings

Generated using TypeDoc