Added support for fetching individual posts. Improved use of yargs, --help now available. Refactored main app flow.

This commit is contained in:
2024-09-11 05:16:54 +02:00
parent 1581e780b8
commit de64cc6d13
7 changed files with 150 additions and 95 deletions
+26
View File
@@ -0,0 +1,26 @@
'use strict';
const config = require('config');
const yargs = require('yargs');
module.exports = yargs.option('users', {
alias: 'user',
describe: 'Reddit usernames to fetch posts from',
type: 'array'
}).option('posts', {
alias: 'post',
describe: 'Reddit post IDs to fetch',
type: 'array'
}).option('limit', {
describe: 'Maximum amount of posts to fetch after filtering out ignored, cross- and reposts',
type: 'number',
default: config.fetch.limit
}).option('sort', {
describe: 'Property to sort posts by',
choices: ['new', 'top', 'hot', 'controversial'],
default: config.fetch.sort
}).option('ignore', {
describe: 'Ignore posts with any of these properties',
type: 'array',
choices: ['pinned', 'stickied', 'hidden', 'spoiler', 'over_18']
}).argv;