@@ -49,7 +49,9 @@ const cli = meow(
4949 flags : {
5050 theme : {
5151 type : 'string' ,
52- alias : [ 'type' ] ,
52+ aliases : [
53+ 'type' ,
54+ ] ,
5355 } ,
5456 light : {
5557 type : 'string' ,
@@ -76,69 +78,67 @@ const cli = meow(
7678 } ,
7779) ;
7880
79- ( async ( ) => {
80- const {
81- theme,
81+ const {
82+ theme,
83+ list,
84+ preserveVariables,
85+ onlyStyle,
86+ onlyVariables,
87+ rootSelector,
88+ } = cli . flags ;
89+
90+ let { light, dark} = cli . flags ;
91+
92+ /*
93+ | Theme | Light | Dark | Outcome |
94+ | ----- | ----- | ---- | ---------------------------------- |
95+ | ✓ | | | Single mode, use Theme |
96+ | ✓ | ✓ | | Not allowed, can't determine theme |
97+ | ✓ | | ✓ | Not allowed, can't determine theme |
98+ | ✓ | ✓ | ✓ | Not allowed, can't determine theme |
99+ | | | | Auto, default themes |
100+ | | ✓ | | Single mode, use Light |
101+ | | | ✓ | Single mode, use Dark |
102+ | | ✓ | ✓ | Auto, use Light and Dark |
103+ | | ✓ | ✓ | Single mode if Light === Dark |
104+ | auto | | | Auto, default themes |
105+ | auto | ✓ | | Auto, use Light, default dark |
106+ | auto | | ✓ | Auto, use Dark, default light |
107+ | auto | ✓ | ✓ | Auto, use Light and Dark |
108+ | auto | ✓ | ✓ | Single mode if Light === Dark |
109+ */
110+
111+ // Use "single" mode when type is a theme name other than 'auto'
112+ if ( theme && theme !== 'auto' ) {
113+ if ( light || dark ) {
114+ console . error ( 'You may not specify light and/or dark unless type/theme is set to "auto"' ) ;
115+ exit ( 1 ) ;
116+ }
117+
118+ light = theme ;
119+ dark = theme ;
120+ }
121+
122+ // If only light or dark was specified set the other to force "single mode"
123+ if ( ! theme && light && ! dark ) {
124+ dark = light ;
125+ } else if ( ! theme && ! light && dark ) {
126+ light = dark ;
127+ }
128+
129+ if ( rootSelector === '' ) {
130+ console . error ( '--rootSelector cannot be an empty string' ) ;
131+ exit ( 1 ) ;
132+ }
133+
134+ console . log (
135+ await githubMarkdownCss ( {
136+ light,
137+ dark,
82138 list,
83139 preserveVariables,
84- onlyStyle,
140+ onlyStyles : onlyStyle ,
85141 onlyVariables,
86142 rootSelector,
87- } = cli . flags ;
88-
89- let { light, dark} = cli . flags ;
90-
91- /*
92- | Theme | Light | Dark | Outcome |
93- | ----- | ----- | ---- | ---------------------------------- |
94- | ✓ | | | Single mode, use Theme |
95- | ✓ | ✓ | | Not allowed, can't determine theme |
96- | ✓ | | ✓ | Not allowed, can't determine theme |
97- | ✓ | ✓ | ✓ | Not allowed, can't determine theme |
98- | | | | Auto, default themes |
99- | | ✓ | | Single mode, use Light |
100- | | | ✓ | Single mode, use Dark |
101- | | ✓ | ✓ | Auto, use Light and Dark |
102- | | ✓ | ✓ | Single mode if Light === Dark |
103- | auto | | | Auto, default themes |
104- | auto | ✓ | | Auto, use Light, default dark |
105- | auto | | ✓ | Auto, use Dark, default light |
106- | auto | ✓ | ✓ | Auto, use Light and Dark |
107- | auto | ✓ | ✓ | Single mode if Light === Dark |
108- */
109-
110- // Use "single" mode when type is a theme name other than 'auto'
111- if ( theme && theme !== 'auto' ) {
112- if ( light || dark ) {
113- console . error ( 'You may not specify light and/or dark unless type/theme is set to "auto"' ) ;
114- exit ( 1 ) ;
115- }
116-
117- light = theme ;
118- dark = theme ;
119- }
120-
121- // If only light or dark was specified set the other to force "single mode"
122- if ( ! theme && light && ! dark ) {
123- dark = light ;
124- } else if ( ! theme && ! light && dark ) {
125- light = dark ;
126- }
127-
128- if ( rootSelector === '' ) {
129- console . error ( '--rootSelector cannot be an empty string' ) ;
130- exit ( 1 ) ;
131- }
132-
133- console . log (
134- await githubMarkdownCss ( {
135- light,
136- dark,
137- list,
138- preserveVariables,
139- onlyStyles : onlyStyle ,
140- onlyVariables,
141- rootSelector,
142- } ) ,
143- ) ;
144- } ) ( ) ;
143+ } ) ,
144+ ) ;
0 commit comments