(argv: ArgumentsCamelCase<CommandArgs>)
| 76 | .epilog(buildEpilog({ command, apiDocs: ['listPreferences', 'getPreferenceById'] })) |
| 77 | |
| 78 | const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => { |
| 79 | const command = await apiOrganizationCommand(argv) |
| 80 | const listTableFieldDefinitions: TableFieldDefinition<DevicePreference & WithOrganization>[] = |
| 81 | ['preferenceId', 'title', 'name', 'description', 'required', 'preferenceType'] |
| 82 | const config: OutputItemOrListConfig<DevicePreference & WithOrganization> = { |
| 83 | itemName: 'device preference', |
| 84 | primaryKeyName: 'preferenceId', |
| 85 | sortKeyName: 'preferenceId', |
| 86 | tableFieldDefinitions, |
| 87 | listTableFieldDefinitions, |
| 88 | } |
| 89 | |
| 90 | await outputItemOrList<DevicePreference & WithOrganization>( |
| 91 | command, |
| 92 | config, |
| 93 | argv.idOrIndex, |
| 94 | async () => { |
| 95 | if (argv.standard) { |
| 96 | return standardPreferences(command) |
| 97 | } else if (argv.namespace) { |
| 98 | return command.client.devicePreferences.list(argv.namespace) |
| 99 | } |
| 100 | else if (argv.allOrganizations) { |
| 101 | listTableFieldDefinitions.push('organization') |
| 102 | return preferencesForAllOrganizations(command) |
| 103 | } |
| 104 | return customPreferences(command) |
| 105 | }, |
| 106 | id => command.client.devicePreferences.get(id), |
| 107 | ) |
| 108 | } |
| 109 | |
| 110 | const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler } |
| 111 | export default cmd |
nothing calls this directly
no test coverage detected