Skip to content

Commit

Permalink
add kittly icat instead of terminal-img
Browse files Browse the repository at this point in the history
  • Loading branch information
imaarov committed Jun 16, 2024
1 parent 1f65646 commit 2307d23
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"devDependencies": {
"@eslint/js": "^9.3.0",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.14.2",
"eslint": "9.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
Expand Down
19 changes: 12 additions & 7 deletions src/utils/canvas.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import terminalImage from "terminal-image";
import chalk from "chalk";
import { spawn } from 'child_process';
import * as path from 'path';

async function displayImage(path: string, imageTitle: string, imageWidth: number = 50): Promise<void> {
const asciiImage: string = await terminalImage.file(path, { width: `${imageWidth}%` });
console.log(asciiImage);
console.log(chalk.bgCyan(imageTitle));
async function displayImage(imagePath: string, imageTitle: string, imageWidth: number = 50): Promise<void> {

Check failure on line 4 in src/utils/canvas.ts

View workflow job for this annotation

GitHub Actions / Lint TypeScript

'imageWidth' is assigned a value but never used
console.log(`Displaying image: ${imageTitle}`);
const fullPath = path.resolve(imagePath);
const child = spawn('kitty', ['+kitten', 'icat', fullPath], { stdio: 'inherit' });

child.on('close', (code: number) => {
if (code !== 0) {
console.log(`Child process exited with code ${code}`);
}
});
}

export default displayImage;


3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:*, @types/node@npm:^20.12.13":
"@types/node@npm:*, @types/node@npm:^20.12.13, @types/node@npm:^20.14.2":
version: 20.14.2
resolution: "@types/node@npm:20.14.2"
dependencies:
Expand Down Expand Up @@ -3937,6 +3937,7 @@ __metadata:
"@inquirer/prompts": "npm:^5.0.4"
"@inquirer/select": "npm:^2.3.2"
"@types/inquirer": "npm:^9.0.7"
"@types/node": "npm:^20.14.2"
canvas: "npm:^2.11.2"
chalk: "npm:^5.3.0"
console-image: "npm:^0.0.0"
Expand Down

0 comments on commit 2307d23

Please sign in to comment.