mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-12-11 00:21:24 +01:00
chore: better Prettier config for easier reviews
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
import { Command, Option } from 'clipanion'
|
||||
import * as typanion from 'typanion'
|
||||
import chalk from 'chalk'
|
||||
import { Command, Option } from "clipanion"
|
||||
import * as typanion from "typanion"
|
||||
import chalk from "chalk"
|
||||
|
||||
import { Solution } from '../../services/Solution.js'
|
||||
import { Solution } from "../../services/Solution.js"
|
||||
|
||||
export class GenerateSolutionCommand extends Command {
|
||||
public static override paths = [['generate', 'solution']]
|
||||
public static override paths = [["generate", "solution"]]
|
||||
|
||||
public static override usage = {
|
||||
description: 'Create the basic files needed for a new solution.'
|
||||
description: "Create the basic files needed for a new solution.",
|
||||
}
|
||||
|
||||
public challenge = Option.String('--challenge', {
|
||||
description: 'The challenge name you want to generate a solution for.',
|
||||
public challenge = Option.String("--challenge", {
|
||||
description: "The challenge name you want to generate a solution for.",
|
||||
required: true,
|
||||
validator: typanion.isString()
|
||||
validator: typanion.isString(),
|
||||
})
|
||||
|
||||
public githubUser = Option.String('--github-user', {
|
||||
description: 'Your GitHub user.',
|
||||
public githubUser = Option.String("--github-user", {
|
||||
description: "Your GitHub user.",
|
||||
required: true,
|
||||
validator: typanion.isString()
|
||||
validator: typanion.isString(),
|
||||
})
|
||||
|
||||
public solutionName = Option.String('--solution', {
|
||||
description: 'The new solution name to generate.',
|
||||
public solutionName = Option.String("--solution", {
|
||||
description: "The new solution name to generate.",
|
||||
required: true,
|
||||
validator: typanion.isString()
|
||||
validator: typanion.isString(),
|
||||
})
|
||||
|
||||
public programmingLanguage = Option.String('--language', {
|
||||
description: 'The programming language to use to solve the challenge.',
|
||||
public programmingLanguage = Option.String("--language", {
|
||||
description: "The programming language to use to solve the challenge.",
|
||||
required: true,
|
||||
validator: typanion.isString()
|
||||
validator: typanion.isString(),
|
||||
})
|
||||
|
||||
public async execute(): Promise<number> {
|
||||
@@ -41,17 +41,17 @@ export class GenerateSolutionCommand extends Command {
|
||||
name: this.solutionName,
|
||||
githubUser: this.githubUser,
|
||||
challengeName: this.challenge,
|
||||
programmingLanguageName: this.programmingLanguage
|
||||
programmingLanguageName: this.programmingLanguage,
|
||||
})
|
||||
console.log(
|
||||
`${chalk.bold.green('Success:')} created the new solution at ${
|
||||
`${chalk.bold.green("Success:")} created the new solution at ${
|
||||
solution.path
|
||||
}.`
|
||||
}.`,
|
||||
)
|
||||
return 0
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(`${chalk.bold.red('Error:')} ${error.message}`)
|
||||
console.error(`${chalk.bold.red("Error:")} ${error.message}`)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user