File tree Expand file tree Collapse file tree
packages/@cz-git/plugin-inquirer/src/shared/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import process from "node:process" ;
2+
3+ /**
4+ * @description check the term is support unicode
5+ */
6+ export const isUnicodeSupport = ( ) => {
7+ if ( process . platform !== "win32" ) {
8+ return process . env . TERM !== "linux" ; // Linux console (kernel)
9+ }
10+
11+ return (
12+ Boolean ( process . env . CI ) ||
13+ Boolean ( process . env . WT_SESSION ) || // Windows Terminal
14+ process . env . ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
15+ process . env . TERM_PROGRAM === "vscode" ||
16+ process . env . TERM === "xterm-256color" ||
17+ process . env . TERM === "alacritty" ||
18+ process . env . TERMINAL_EMULATOR === "JetBrains-JediTerm"
19+ ) ;
20+ } ;
21+
22+ const mainSymbols = {
23+ pointer : "❯" ,
24+ radioOn : "◉" ,
25+ radioOff : "◯"
26+ } ;
27+
28+ const fallbackSymbols = {
29+ pointer : ">" ,
30+ radioOn : "(*)" ,
31+ radioOff : "( )"
32+ } ;
33+
34+ export const figures = isUnicodeSupport ( ) ? mainSymbols : fallbackSymbols ;
Original file line number Diff line number Diff line change 1- export * from "./inquirer " ;
1+ export * from "./figure " ;
22export * from "./style" ;
33export * from "./fuzzy" ;
Original file line number Diff line number Diff line change 44 * @license MIT
55 */
66
7- import process from "node:process " ;
7+ import type Separator from "inquirer/lib/objects/separator " ;
88import type { ChoiceType } from "../types" ;
99
10- /**
11- * @description check the term is support unicode
12- */
13- export const isUnicodeSupport = ( ) => {
14- if ( process . platform !== "win32" ) {
15- return process . env . TERM !== "linux" ; // Linux console (kernel)
16- }
17-
18- return (
19- Boolean ( process . env . CI ) ||
20- Boolean ( process . env . WT_SESSION ) || // Windows Terminal
21- process . env . ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
22- process . env . TERM_PROGRAM === "vscode" ||
23- process . env . TERM === "xterm-256color" ||
24- process . env . TERM === "alacritty" ||
25- process . env . TERMINAL_EMULATOR === "JetBrains-JediTerm"
26- ) ;
27- } ;
28-
2910/**
3011 * @description : check the target is Promise
3112 */
@@ -36,4 +17,5 @@ export const isPromise = (target: any) => {
3617/**
3718 * @description : check choice is selectable
3819 */
39- export const isSelectable = ( choice : ChoiceType ) => choice . type !== "separator" && ! choice . disabled ;
20+ export const isSelectable = ( choice : ChoiceType < Separator [ "type" ] > ) =>
21+ choice . type !== "separator" && ! choice . disabled ;
You can’t perform that action at this time.
0 commit comments