Skip to content

Commit

Permalink
🔧 Change baby blahaj render to viu
Browse files Browse the repository at this point in the history
  • Loading branch information
sech1p committed Sep 2, 2024
1 parent a16255f commit 6b8e2be
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Usage: blahaj [options] [command]
Options:
-V, --version output the version number
-c, --classic output the blahaj in legacy way by jimp (low quality so you are warned!)
-b, --baby output the baby blahaj
-b, --baby output the baby blahaj (use classic keyword after --baby argument if you want render it by legacy way)
-h, --help display help for command

Commands:
Expand All @@ -31,6 +31,8 @@ $ blahaj --classic

$ blahaj --baby

$ blahaj --baby classic

$ blahaj ascii_art --default # (or --pride)
```
Expand Down
35 changes: 25 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,31 @@ const main = async (_arguments: string[]) => {
program
.option("-b, --baby", "output the baby blahaj")
.action(async () => {
console.log(
await draw(
BABY_BLAHAJ_URL,
{
width: 80,
height: 80,
},
),
);
process.exit(0);
if (_arguments.includes("classic")) {
console.log(
await draw(
BABY_BLAHAJ_URL,
{
width: 80,
height: 80,
},
),
);
process.exit(0);
}

checkIfCommandExists("viu --version")
.then((exists) => {
if (exists) {
spawn(`curl`, [`${BABY_BLAHAJ_URL} -o /tmp/baby_blahaj.jpg`]);
console.log();
spawn("viu", ["/tmp/baby_blahaj.jpg"], { stdio: "inherit" });
process.exit(0);
} else {
console.error("❌ viu command not found! Please install it from https://github.com/atanunq/viu");
process.exit(1);
}
});
});

program.parse(_arguments);
Expand Down

0 comments on commit 6b8e2be

Please sign in to comment.