Alex Mikhalev
6 years ago
1 changed files with 32 additions and 0 deletions
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
import { flags } from "@oclif/command"; |
||||
import * as auth from "@server/authentication" |
||||
|
||||
import ManageCommand from "@server/ManageCommand"; |
||||
|
||||
// tslint:disable:no-shadowed-variable
|
||||
|
||||
export default class TokenCommand extends ManageCommand { |
||||
static description = "Manage tokens"; |
||||
|
||||
static flags = { |
||||
"gen-device-reg": flags.boolean({ |
||||
char: "d", |
||||
description: "Generate a device registration token", |
||||
}), |
||||
}; |
||||
|
||||
async run() { |
||||
const parseResult = this.parse(TokenCommand); |
||||
|
||||
const flags = parseResult.flags; |
||||
|
||||
if (flags["gen-device-reg"]) { |
||||
const token = await auth.generateDeviceRegistrationToken(); |
||||
this.log(`Device registration token: "${token}"`) |
||||
} else { |
||||
this.error("Must specify a command to run"); |
||||
this._help(); |
||||
} |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue