Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/__tests__/lib/command/smartthings-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ const {


test('smartThingsCommandBuilder', () => {
const { envMock, optionMock, argvMock } = buildArgvMock<object, SmartThingsCommandFlags>()
const { optionMock, argvMock } = buildArgvMock<object, SmartThingsCommandFlags>()

expect(smartThingsCommandBuilder(argvMock)).toBe(argvMock)

expect(envMock).toHaveBeenCalledTimes(1)
expect(optionMock).toHaveBeenCalledTimes(2)
})

Expand Down
8 changes: 7 additions & 1 deletion src/lib/command/api-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ export type APICommandFlags = SmartThingsCommandFlags & {

export const apiCommandBuilder = <T extends object>(yargs: Argv<T>): Argv<T & APICommandFlags> =>
smartThingsCommandBuilder(yargs)
.option('token', { alias: 't', desc: 'the auth token to use', type: 'string' })
.option('token', {
alias: 't',
desc: 'the auth token to use',
type: 'string',
default: process.env.SMARTTHINGS_TOKEN,
hidden: true,
})
.option('language', {
desc: 'ISO language code or "NONE" to not specify a language. Defaults to the OS locale',
type: 'string',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/command/smartthings-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export type SmartThingsCommandFlags = {
export const smartThingsCommandBuilder = <T extends object = object>(
yargs: Argv<T>,
): Argv<T & SmartThingsCommandFlags> =>
yargs.env('SMARTTHINGS')
yargs
.option('profile', {
alias: 'p',
describe: 'configuration profile',
type: 'string',
default: 'default',
default: process.env.SMARTTHINGS_PROFILE ?? 'default',
})
// This option is temporary and will be removed when removing automatic copy
// of old configuration files. (See also yargs-transition-temp.ts.)
Expand Down