11const { Command } = require ( "commander" ) ;
22const program = new Command ( ) ;
3+
34program . version ( "0.0.1" ) ;
5+ program . name ( "JSCritty" ) ;
6+ program . description (
7+ "CLI that allows you to change your Alacritty config with one command without editting the config file."
8+ ) ;
49
5- program
6- . name ( "JSCritty" )
7- . option ( "-t, --theme [theme]" , "Change the theme of alacritty" )
8- . option ( "-f, --font [font]" , "Change the font of alacritty" )
9- . option ( "-s, --size [size]" , "Change the font size of alacritty" )
10- . option ( "-o, --opacity [opacity]" , "Change the opacity of alacritty" )
11- . option ( "-p, --padding [x] [y]" , "Change the padding of alacritty" )
12- . option (
13- "-O, --offset [x] [y]" ,
14- "Change offset, X is space between chars and Y is line height of alacritty"
15- )
16- . option (
17- "-l, --list [fonts, themes, all]" ,
18- 'List all available options from resource, default is "all"'
19- )
20- . option (
21- "-P, --print [config, fonts]" ,
22- "Print the content of config files or themes by specifying their name of alacritty"
23- ) ;
10+ program . option ( "-t, --theme <theme>" , "Change the theme of alacritty" ) ;
11+ program . option ( "-f, --font <font>" , "Change the font of alacritty" ) ;
12+ program . option ( "-s, --size <size>" , "Change the font size of alacritty" ) ;
13+ program . option ( "-o, --opacity <opacity>" , "Change the opacity of alacritty" ) ;
14+ program . option ( "-p, --padding <cords...>" , "Change the padding of alacritty" ) ;
15+ program . option (
16+ "-O, --offset <cords...>" ,
17+ "Change offset, X is space between chars and Y is line height of alacritty"
18+ ) ;
19+ program . option (
20+ "-l, --list <fonts, themes, all>" ,
21+ 'List all available options from resource, default is "all"'
22+ ) ;
23+ program . option (
24+ "-P, --print <config, fonts>" ,
25+ "Print the content of config files or themes by specifying their name of alacritty"
26+ ) ;
2427
2528const {
2629 theme,
@@ -33,21 +36,18 @@ const {
3336 print,
3437} = program . parse ( process . argv ) ;
3538
36- // console.log(program.opts());
37- // console.log(program.args);
38-
3939const flags = {
4040 theme,
4141 font,
4242 size,
4343 opacity,
4444 padding : {
45- x : padding ,
46- y : offset ? undefined : program . args [ 0 ] ,
45+ x : padding ? Number ( padding [ 0 ] ) : undefined ,
46+ y : padding ? Number ( padding [ 1 ] ) : undefined ,
4747 } ,
4848 offset : {
49- x : offset ,
50- y : padding ? undefined : program . args [ 0 ] ,
49+ x : offset ? Number ( offset [ 0 ] ) : undefined ,
50+ y : offset ? Number ( offset [ 1 ] ) : undefined ,
5151 } ,
5252 list : list ,
5353 print : print ,
0 commit comments