Add new limit option to limit the requested amount of posts from the Reddit API (#203)
All checks were successful
Test / build (push) Successful in 8s
All checks were successful
Test / build (push) Successful in 8s
- Add the limit option - Valid number between 1 and 100 - Defaults to 100 - Updated documentation to mention this #137 Reviewed-on: #203 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
6f0109ae6e
commit
2b3e65302b
12 changed files with 170 additions and 17 deletions
|
@ -14,11 +14,12 @@ program
|
|||
.option('-j, --json', 'Output as JSON')
|
||||
.option('-q, --query-metadata', 'Include query metadata in result')
|
||||
.option('-o <file>', 'Output to file')
|
||||
.addOption(new Option('--sort <sort>', 'Sort by').default('hot').choices(['hot', 'new', 'top']));
|
||||
.addOption(new Option('--sort <sort>', 'Sort by').default('hot').choices(['hot', 'new', 'top']))
|
||||
.addOption(new Option('--limit <limit>', 'The amount of posts to fetch from the reddit api').default(100));
|
||||
|
||||
program.parse();
|
||||
|
||||
const options: ICliOptions = program.opts();
|
||||
|
||||
randomBunny(options.subreddit, options.sort)
|
||||
randomBunny(options.subreddit, options.sort, options.limit)
|
||||
.then((response) => exit(CliHelper.Endpoint(response, options)));
|
Loading…
Add table
Add a link
Reference in a new issue