Skip to content

Commit

Permalink
Merge pull request #216 from garden-io/fix-banner-image
Browse files Browse the repository at this point in the history
fix(cli): show ANSI banner image in dev command when not in iTerm2
  • Loading branch information
edvald authored Jul 20, 2018
2 parents bfd7f07 + bb3898f commit 3dece12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
14 changes: 5 additions & 9 deletions garden-cli/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { STATIC_DIR } from "../constants"
import chalk from "chalk"
import moment = require("moment")
import { processModules } from "../process"
import { readFile } from "fs-extra"

const imgcatPath = join(STATIC_DIR, "imgcat")
const bannerPath = join(STATIC_DIR, "garden-banner-1-half.png")
const ansiBannerPath = join(STATIC_DIR, "garden-banner-2.txt")

// TODO: allow limiting to certain modules and/or services
export class DevCommand extends Command {
Expand All @@ -39,13 +39,9 @@ export class DevCommand extends Command {
`

async action(ctx: PluginContext): Promise<CommandResult> {
try {
await execa(imgcatPath, [bannerPath], {
stdio: "inherit",
})
} catch (_) {
// the above fails for terminals other than iTerm2. just ignore the error and move on.
}
// print ANSI banner image
const data = await readFile(ansiBannerPath)
console.log(data.toString())

ctx.log.info(chalk.gray.italic(`\nGood ${getGreetingTime()}! Let's get your environment wired up...\n`))

Expand Down
7 changes: 7 additions & 0 deletions garden-cli/static/garden-banner-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
                                   
                                   
                                   
                                   
                                   
                                   
                                   

0 comments on commit 3dece12

Please sign in to comment.