From 13226881189232e2b3e77ecd0bc06f03645a7cfe Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Thu, 9 Feb 2023 09:09:33 +0100 Subject: [PATCH] cli: Add admin skeleton command Signed-off-by: Marcus Eide --- packages/cli/src/commands/admin/command.ts | 31 ++++++++++++++++++++++ packages/cli/src/commands/admin/index.ts | 17 ++++++++++++ packages/cli/src/commands/index.ts | 8 ++++++ 3 files changed, 56 insertions(+) create mode 100644 packages/cli/src/commands/admin/command.ts create mode 100644 packages/cli/src/commands/admin/index.ts diff --git a/packages/cli/src/commands/admin/command.ts b/packages/cli/src/commands/admin/command.ts new file mode 100644 index 0000000000..3539ddc40c --- /dev/null +++ b/packages/cli/src/commands/admin/command.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import chalk from 'chalk'; +import inquirer from 'inquirer'; +import { Task } from '../../lib/tasks'; + +export async function command(): Promise { + const answers = await inquirer.prompt<{ github: boolean }>([ + { + type: 'confirm', + name: 'github', + message: chalk.blue('Do you want to set up GitHub Authentication?'), + }, + ]); + + Task.log(answers.github ? 'Ok!' : 'Maybe next time'); +} diff --git a/packages/cli/src/commands/admin/index.ts b/packages/cli/src/commands/admin/index.ts new file mode 100644 index 0000000000..4c23ea6e48 --- /dev/null +++ b/packages/cli/src/commands/admin/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { command } from './command'; diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index ddec5c6a4a..2baf1aac9b 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -25,6 +25,13 @@ const configOption = [ Array(), ] as const; +export function registerAdminCommand(program: Command) { + program + .command('admin') + .description('Get help setting up your Backstage App.') + .action(lazy(() => import('./admin').then(m => m.command))); +} + export function registerRepoCommand(program: Command) { const command = program .command('repo [command]') @@ -360,6 +367,7 @@ export function registerCommands(program: Command) { registerRepoCommand(program); registerScriptCommand(program); registerMigrateCommand(program); + registerAdminCommand(program); program .command('versions:bump')