@astrojs/cli-kit
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -41,6 +41,6 @@ import readline from 'node:readline'; | ||
const _messages = Array.isArray(messages) ? messages : [messages]; | ||
const eyes = useAscii ? ['•', '•', 'o', 'o', '•', 'O', '^', '•'] : ['●', '●', '●', '●', '●', '○', '○', '•']; | ||
const mouths = useAscii ? ['•', 'O', '*', 'o', 'o', '•', '-'] : ['•', '○', '■', '▪', '▫', '▬', '▭', '-', '○']; | ||
const walls = useAscii ? ['—', '|'] : ['─', '│']; | ||
const corners = useAscii ? ['+', '+', '+', '+'] : ['╭', '╮', '╰', '╯']; | ||
const eyes = useAscii() ? ['•', '•', 'o', 'o', '•', 'O', '^', '•'] : ['●', '●', '●', '●', '●', '○', '○', '•']; | ||
const mouths = useAscii() ? ['•', 'O', '*', 'o', 'o', '•', '-'] : ['•', '○', '■', '▪', '▫', '▬', '▭', '-', '○']; | ||
const walls = useAscii() ? ['—', '|'] : ['─', '│']; | ||
const corners = useAscii() ? ['+', '+', '+', '+'] : ['╭', '╮', '╰', '╯']; | ||
const face = (msg, { mouth = mouths[0], eye = eyes[0] } = {}) => { | ||
@@ -74,3 +74,3 @@ const [h, v] = walls; | ||
await sleep(100); | ||
const text = '\n' + face(_message.join(' '), { mouth: useAscii ? 'u' : '◡', eye: useAscii ? '^' : '◠' }); | ||
const text = '\n' + face(_message.join(' '), { mouth: useAscii() ? 'u' : '◡', eye: useAscii() ? '^' : '◠' }); | ||
logUpdate(text); | ||
@@ -77,0 +77,0 @@ if (!cancelled) |
@@ -135,3 +135,3 @@ import Prompt from './prompt.js'; | ||
else { | ||
this.outputText.push(this.choices.map((choice, i) => i === this.cursor ? `${prefix} ${color.green(useAscii ? '>' : '●')} ${this.highlight(choice.label)} ${choice.hint ? color.dim(choice.hint) : ''}` : color.dim(`${prefix} ${useAscii ? '—' : '○'} ${choice.label} `)).join('\n')); | ||
this.outputText.push(this.choices.map((choice, i) => i === this.cursor ? `${prefix} ${color.green(useAscii() ? '>' : '●')} ${this.highlight(choice.label)} ${choice.hint ? color.dim(choice.hint) : ''}` : color.dim(`${prefix} ${useAscii() ? '—' : '○'} ${choice.label} `)).join('\n')); | ||
} | ||
@@ -138,0 +138,0 @@ this.outputText = this.outputText.join(''); |
@@ -198,3 +198,3 @@ import Prompt from './prompt.js'; | ||
if (this.error) { | ||
this.outputError += ` ${color.redBright((useAscii ? '> ' : '▶ ') + this.errorMsg)}`; | ||
this.outputError += ` ${color.redBright((useAscii() ? '> ' : '▶ ') + this.errorMsg)}`; | ||
} | ||
@@ -201,0 +201,0 @@ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0)); |
/// <reference types="node" /> | ||
export declare let useAscii: boolean; | ||
export declare function forceUnicode(): void; | ||
export declare const useAscii: () => boolean; | ||
export declare const hookExit: () => () => NodeJS.Process; | ||
@@ -4,0 +5,0 @@ export declare const sleep: (ms: number) => Promise<unknown>; |
@@ -6,3 +6,7 @@ import color from 'chalk'; | ||
import { strip } from '../prompt/util/clear.js'; | ||
export let useAscii = platform() === 'win32'; | ||
const unicode = { enabled: platform() !== 'win32' }; | ||
export function forceUnicode() { | ||
unicode.enabled = true; | ||
} | ||
export const useAscii = () => !unicode.enabled; | ||
export const hookExit = () => { | ||
@@ -9,0 +13,0 @@ const onExit = (code) => { |
{ | ||
"name": "@astrojs/cli-kit", | ||
"type": "module", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51847
1591