1
1
import yargs from 'yargs' ;
2
+ import { ColorSchemeType } from 'diff2html/lib/types.js' ;
2
3
3
4
import {
4
5
StyleType ,
@@ -35,6 +36,7 @@ export type Argv = {
35
36
title ?: string ;
36
37
ignore ?: string [ ] ;
37
38
extraArguments : string [ ] ;
39
+ colorScheme : ColorSchemeType ;
38
40
} ;
39
41
40
42
const defaults : Argv = {
@@ -59,6 +61,7 @@ const defaults: Argv = {
59
61
htmlWrapperTemplate : undefined ,
60
62
title : undefined ,
61
63
extraArguments : [ ] ,
64
+ colorScheme : ColorSchemeType . AUTO ,
62
65
} ;
63
66
64
67
type ArgvChoices = {
@@ -70,6 +73,7 @@ type ArgvChoices = {
70
73
input : ReadonlyArray < InputType > ;
71
74
output : ReadonlyArray < OutputType > ;
72
75
diffy : ReadonlyArray < DiffyType > ;
76
+ colorScheme : ReadonlyArray < ColorSchemeType > ;
73
77
} ;
74
78
75
79
const choices : ArgvChoices = {
@@ -81,6 +85,7 @@ const choices: ArgvChoices = {
81
85
input : [ 'file' , 'command' , 'stdin' ] ,
82
86
output : [ 'preview' , 'stdout' ] ,
83
87
diffy : [ 'browser' , 'pbcopy' , 'print' ] ,
88
+ colorScheme : [ ColorSchemeType . AUTO , ColorSchemeType . DARK , ColorSchemeType . LIGHT ] ,
84
89
} ;
85
90
86
91
export async function setup ( ) : Promise < Argv > {
@@ -229,6 +234,12 @@ export async function setup(): Promise<Argv> {
229
234
type : 'array' ,
230
235
default : defaults . ignore ,
231
236
} )
237
+ . option ( 'colorScheme' , {
238
+ alias : 'cs' ,
239
+ describe : 'Color scheme of HTML output' ,
240
+ choices : choices . colorScheme ,
241
+ default : defaults . colorScheme ,
242
+ } )
232
243
. example (
233
244
'diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1' ,
234
245
'diff last commit, line by line, word comparison between lines,' +
0 commit comments