Skip to content

Commit 8cd9db8

Browse files
scnaleevan-gray
authored andcommitted
cli: fixes yargs argument type inferral
1 parent 848df2b commit 8cd9db8

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

cli/src/index.ts

+19-24
Original file line numberDiff line numberDiff line change
@@ -29,40 +29,35 @@ yargs(hideBin(process.argv))
2929
.command(
3030
"deploy",
3131
"deploy the solana program",
32-
(yargs) => {
33-
yargs.option("network", NETWORK_OPTIONS)
34-
},
32+
(yargs) => yargs.option("network", NETWORK_OPTIONS),
3533
(argv) => {
3634
throw new Error("Not implemented");
3735
})
3836
.command(
3937
"upgrade",
4038
"upgrade the solana program",
41-
(yargs) => {
42-
yargs
43-
.option("network", NETWORK_OPTIONS)
44-
.option("dir", {
45-
alias: "d",
46-
describe: "Path to the solana workspace",
47-
default: ".",
48-
demandOption: false,
49-
type: "string",
50-
})
51-
.option("keypair", {
52-
alias: "k",
53-
describe: "Path to the keypair",
54-
demandOption: true,
55-
type: "string",
56-
})
57-
},
39+
(yargs) => yargs
40+
.option("network", NETWORK_OPTIONS)
41+
.option("dir", {
42+
alias: "d",
43+
describe: "Path to the solana workspace",
44+
default: ".",
45+
demandOption: false,
46+
type: "string",
47+
})
48+
.option("keypair", {
49+
alias: "k",
50+
describe: "Path to the keypair",
51+
demandOption: true,
52+
type: "string",
53+
}),
5854
async (argv) => {
5955
// TODO: the hardcoded stuff should be factored out once
6056
// we support other networks and programs
6157
// TODO: currently the keypair is the upgrade authority. we should support governance program too
62-
// TODO: why does typescript not like the yargs types?
63-
const network: string = argv.network as string;
64-
const keypair: string = argv.keypair as string;
65-
const dir: string = argv.dir as string;
58+
const network = argv.network;
59+
const keypair = argv.keypair;
60+
const dir = argv.dir;
6661
const objectFile = "example_native_token_transfers.so";
6762
const programId = "nttiK1SepaQt6sZ4WGW5whvc9tEnGXGxuKeptcQPCcS";
6863
assertNetwork(network);

0 commit comments

Comments
 (0)