Skip to content

Commit fe66a63

Browse files
committed
chore: print usage
1 parent 7d52457 commit fe66a63

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

utils/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ async function printTopAccountBalances(count: number, blockHeight: number) {
114114
await db.close();
115115
}
116116

117+
function printUsage() {
118+
console.log(`Usage:`);
119+
console.log(` node ./index.js stx-balances [--count=<count>] [--block-height=<height>]`);
120+
}
121+
117122
async function handleProgramArgs() {
118123
const parsedOpts = getopts(process.argv.slice(2));
119124
const args = {
@@ -130,10 +135,10 @@ async function handleProgramArgs() {
130135
if (args.operand === 'stx-balances') {
131136
await printTopAccountBalances(args.options.count ?? 10, args.options['block-height'] ?? 0);
132137
} else if (parsedOpts._[0]) {
138+
printUsage();
133139
throw new Error(`Unexpected program argument: ${parsedOpts._[0]}`);
134140
} else {
135-
// TODO: Display usage.
136-
throw new Error(`Program arguments required`);
141+
printUsage();
137142
}
138143
}
139144

0 commit comments

Comments
 (0)