Skip to content

Commit d0b6a67

Browse files
committed
aliases
1 parent 78a431d commit d0b6a67

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules
22
.env
3+
*.json
4+

github.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,35 @@ yargs
1717
.option("owner", {
1818
describe: "Owner of the repository",
1919
demandOption: true,
20+
alias: "o",
2021
type: "string",
2122
})
2223
.option("repo", {
2324
describe: "Name of the repository",
2425
demandOption: true,
26+
alias: "r",
2527
type: "string",
2628
})
2729
.option("branch", {
2830
describe: "Name of the branch to commit to",
2931
demandOption: true,
32+
alias: "b",
3033
type: "string",
3134
})
3235
.option("changed", {
3336
describe: "Paths of new or modified files",
34-
alias: "added",
37+
alias: "c",
3538
type: "array",
3639
})
3740
.option("deleted", {
3841
describe: "Paths of tracked deleted files",
42+
alias: "d",
3943
type: "array",
4044
})
4145
.option("commitMessage", {
4246
describe: "Mandatory commit message",
4347
demandOption: true,
48+
alias: "m",
4449
type: "string",
4550
})
4651
.option("commitDescription", {
@@ -49,12 +54,13 @@ yargs
4954
})
5055
.check((argv) => {
5156
if (!argv.changed && !argv.deleted) {
52-
throw new Error("Missing required argument: either specify changed or deleted files.");
57+
throw new Error(
58+
"Missing required argument: either specify changed or deleted files."
59+
);
5360
}
5461
extractChangedOrDeletedFiles(argv.changed, argv.deleted);
5562
return true;
56-
})
57-
;
63+
});
5864
},
5965
(argv) => {
6066
const {
@@ -93,16 +99,19 @@ yargs
9399
.option("owner", {
94100
describe: "Owner of the repository",
95101
demandOption: true,
102+
alias: "o",
96103
type: "string",
97104
})
98105
.option("repo", {
99106
describe: "Name of the repository",
100107
demandOption: true,
108+
alias: "r",
101109
type: "string",
102110
})
103111
.option("branch", {
104112
describe: "Name of the branch to check for existence",
105113
demandOption: true,
114+
alias: "b",
106115
type: "string",
107116
});
108117
},
@@ -124,4 +133,8 @@ yargs
124133
)
125134
.demandCommand()
126135
.version(CURRENT_VERSION)
136+
.alias({
137+
h: "help",
138+
v: "version"
139+
})
127140
.help().argv;

0 commit comments

Comments
 (0)