File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 11import either , { type Either } from '@matt.kantor/either'
2+ import kleur from 'kleur'
23import { parseArgs } from 'node:util'
34import { type SyntaxTree } from '../parsing/syntax-tree.js'
45import {
@@ -17,10 +18,18 @@ export const handleOutput = async (
1718 args : process . argv . slice ( 2 ) , // remove `execPath` and `filename`
1819 strict : false ,
1920 options : {
21+ 'no-color' : { type : 'boolean' } ,
2022 'output-format' : { type : 'string' } ,
2123 } ,
2224 } )
2325
26+ const noColorArg = args . values [ 'no-color' ] ?? false
27+ if ( typeof noColorArg !== 'boolean' ) {
28+ throw new Error ( 'Unsupported value for --no-color' )
29+ } else if ( noColorArg === true ) {
30+ kleur . enabled = false
31+ }
32+
2433 const outputFormatArg = args . values [ 'output-format' ]
2534 let notation : Notation
2635 if ( outputFormatArg === undefined ) {
You can’t perform that action at this time.
0 commit comments