Permalink
Browse files

🎨 Unifies switch style

  • Loading branch information...
mixn committed Oct 23, 2018
1 parent e39546c commit 6a015fb8435bfdcb2434d112f7611422012fb5ed
Showing with 31 additions and 19 deletions.
  1. +19 βˆ’13 cli.js
  2. +6 βˆ’3 src/headless-visit.js
  3. +6 βˆ’3 src/util/img-to-clipboard.js
32 cli.js
@@ -228,25 +228,31 @@ if (!FILE) {
${green('Done!')}`
);
if (OPEN) {
console.log(`
switch (true) {
case OPEN: {
console.log(`
Browser opened β€” finish your image there! 😌`
);
} else if (COPY) {
console.log(`
);
break;
}
case COPY: {
console.log(`
Image copied to clipboard! 😌`
);
} else {
console.log(`
);
break;
}
default: {
console.log(`
The file can be found here: ${downloadedAs} 😌`
);
);
if (process.env.TERM_PROGRAM && process.env.TERM_PROGRAM.match('iTerm')) {
console.log(`
if (process.env.TERM_PROGRAM && process.env.TERM_PROGRAM.match('iTerm')) {
console.log(`
iTerm2 should display the image below. 😊
${await terminalImage.file(downloadedAs)}`
);
${await terminalImage.file(downloadedAs)}`
);
}
}
}
@@ -55,14 +55,17 @@ module.exports = async (url, location = process.cwd(), type = 'png', headless =
const svgExportTrigger = await page.$('#downshift-2-item-1');
switch (type) {
case 'png':
case 'png': {
await pngExportTrigger.click();
break;
case 'svg':
}
case 'svg': {
await svgExportTrigger.click();
break;
default:
}
default: {
throw new Error('Only png and svg are supported.');
}
}
}
@@ -6,14 +6,17 @@ module.exports = async imgPath => {
let SCRIPT;
switch (OS) {
case 'darwin':
case 'darwin': {
SCRIPT = `osascript -e 'set the clipboard to (read (POSIX file "${imgPath}") as JPEG picture)'`;
break;
case 'win32':
}
case 'win32': {
SCRIPT = `nircmd clipboard copyimage ${imgPath}`;
break;
default:
}
default: {
SCRIPT = `xclip -selection clipboard -t image/png -i ${imgPath}`;
}
}
// Running `await execa` leads to `Listr` not resolving the last task on Linux

0 comments on commit 6a015fb

Please sign in to comment.