Skip to content

Commit 64fe21b

Browse files
Troubleshoot parser options (padding, offset)
1 parent 7847ff7 commit 64fe21b

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ Change your alacritty config on the fly!
99
mkdir -p ~/.config/alacritty
1010
cd ~/.config/alacritty
1111
git clone https://github.com/CodingLeonardo/jscritty
12-
<<<<<<< HEAD
1312
cd jscritty
1413
npm install
1514
cd ..
16-
=======
17-
npm install
18-
>>>>>>> fd83b3c166a0b20668f09f410dbc7be21f7d9395
1915
# Create themes and fonts configs
2016
cp jscritty/config/fonts.yaml fonts.yaml
2117
cp -r jscritty/config/themes themes

src/cli.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
const { Command } = require("commander");
22
const program = new Command();
3+
34
program.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

2528
const {
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-
3939
const 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

Comments
 (0)