Skip to content

Commit

Permalink
cli: add logo
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Razon committed Oct 25, 2023
1 parent 90a30b4 commit 53f4cf4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/cli-common/src/lib/text.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Config } from '@oclif/core'
import chalk from 'chalk'
import { EOL } from 'os'

export const code = (c: string) => chalk.bold(c)

Expand All @@ -12,3 +13,22 @@ export const highlight = (s: string) => chalk.greenBright(s)
export const success = (s: string) => chalk.greenBright(s)

export const recommendation = (s: string) => chalk.cyan(s)

const mag = chalk.rgb(255, 128, 197)

export const logo = [
'',
`${mag('@@@@')} @@@@`,
`${mag('@@@@@')}@@@@@@`,
`${mag('@@@@@')}@@@@@@@@ @@@@@@@@@@`,
`${mag('@@@@@')}@@@@@@@@@ @@@ @@@ @@ @@@ @@@@@% @@@@@ @@ @@@ @@@ @@@`,
`${mag('@@@@@')}@@@@@@@@@ @@@ @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@`,
`${mag('@@@@@@@@@')} @@@@@@@@@ @@ @@@@@@@@@ @@@@@@@@@ @@@ @@ @@ @@`,
`${mag('@@@@@@@@@')} @@@ @@ @@@ @@@ @@@@@@ @@@@`,
` ${mag('@@@@@@@@')} @@@ @@ @@@@@@@@ @@@@@@@@ @@@@ @@@@`,
` ${mag('@@@@@@')} @@@`,
` ${mag('@@@')} @@@@@`,
'',
].join(EOL)

export const { supportsColor } = chalk
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"plugins": [
"@oclif/plugin-help"
],
"helpClass": "./dist/help",
"hooks": {
"init": [
"./dist/hooks/init/sync-logging",
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ export default class Init extends BaseCommand {
return undefined
}

if (text.supportsColor) {
this.log(text.logo)
}

const driver = await chooseDriver()
const driverStatic = machineDrivers[driver]

Expand Down
11 changes: 11 additions & 0 deletions packages/cli/src/help.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Help as HelpBase } from '@oclif/core'
import { logo } from '@preevy/cli-common/src/lib/text'

export default class Help extends HelpBase {
override async showRootHelp(): Promise<void> {
if (!this.opts.stripAnsi) {
this.log(logo)
}
return await super.showRootHelp()
}
}

0 comments on commit 53f4cf4

Please sign in to comment.