Rewrite comments

1ef04ffc4dc7d4be5e2cc499bfe1154b0490f4a1

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +16 -19Ignore whitespace
src/command-line.js+16 -19
@@ -34,12 +34,8 @@ import { canResolve, color, getConfigValue, stringToBool } from './util.js';
34 */34 */
3535
36/**36/**
37 * Gets the hostname to use for autorun in the browser.37 * Provides a command line arguments parser.
38 * @param {boolean} useIPv6 If use IPv6
39 * @param {boolean} useIPv4 If use IPv4
40 * @returns {Promise<string>} The hostname to use for autorun
41 */38 */
42
43export class CommandLineParser {39export class CommandLineParser {
44 constructor() {40 constructor() {
45 /** @type {CommandLineArguments} */41 /** @type {CommandLineArguments} */
@@ -85,32 +81,33 @@ export class CommandLineParser {
8581
86 /**82 /**
87 * Parses command line arguments.83 * Parses command line arguments.
84 * Arguments that are not provided will be filled with config values.
88 * @param {string[]} args Process startup arguments.85 * @param {string[]} args Process startup arguments.
89 * @returns {CommandLineArguments} Parsed command line arguments.86 * @returns {CommandLineArguments} Parsed command line arguments.
90 */87 */
91 parse(args) {88 parse(args) {
92 const cliArguments = yargs(hideBin(args))89 const cliArguments = yargs(hideBin(args))
93 .usage('Usage: <your-start-script> <command> [options]')90 .usage('Usage: <your-start-script> [options]\nOptions that are not provided will be filled with config values.')
94 .option('enableIPv6', {91 .option('enableIPv6', {
95 type: 'string',92 type: 'string',
96 default: null,93 default: null,
97 describe: 'Enables IPv6 protocol.',94 describe: 'Enables IPv6 protocol',
98 }).option('enableIPv4', {95 }).option('enableIPv4', {
99 type: 'string',96 type: 'string',
100 default: null,97 default: null,
101 describe: 'Enables IPv4 protocol.',98 describe: 'Enables IPv4 protocol',
102 }).option('port', {99 }).option('port', {
103 type: 'number',100 type: 'number',
104 default: null,101 default: null,
105 describe: 'Sets the port under which SillyTavern will run.\nIf not provided falls back to yaml config \'port\'.',102 describe: 'Sets the server listening port',
106 }).option('dnsPreferIPv6', {103 }).option('dnsPreferIPv6', {
107 type: 'boolean',104 type: 'boolean',
108 default: null,105 default: null,
109 describe: 'Prefers IPv6 for DNS\nyou should probably have the enabled if you\'re on an IPv6 only network\nIf not provided falls back to yaml config \'dnsPreferIPv6\'.',106 describe: 'Prefers IPv6 for DNS\nYou should probably have the enabled if you\'re on an IPv6 only network',
110 }).option('autorun', {107 }).option('autorun', {
111 type: 'boolean',108 type: 'boolean',
112 default: null,109 default: null,
113 describe: 'Automatically launch SillyTavern in the browser.\nAutorun is automatically disabled if --ssl is set to true.\nIf not provided falls back to yaml config \'autorun\'.',110 describe: 'Automatically launch SillyTavern in the browser',
114 }).option('autorunHostname', {111 }).option('autorunHostname', {
115 type: 'string',112 type: 'string',
116 default: null,113 default: null,
@@ -122,23 +119,23 @@ export class CommandLineParser {
122 }).option('listen', {119 }).option('listen', {
123 type: 'boolean',120 type: 'boolean',
124 default: null,121 default: null,
125 describe: 'SillyTavern is listening on all network interfaces (Wi-Fi, LAN, localhost). If false, will limit it only to internal localhost (127.0.0.1).\nIf not provided falls back to yaml config \'listen\'.',122 describe: 'Whether to listen on all network interfaces',
126 }).option('listenAddressIPv6', {123 }).option('listenAddressIPv6', {
127 type: 'string',124 type: 'string',
128 default: null,125 default: null,
129 describe: 'Set SillyTavern to listen to a specific IPv6 address. If not set, it will fallback to listen to all.',126 describe: 'Specific IPv6 address to listen to',
130 }).option('listenAddressIPv4', {127 }).option('listenAddressIPv4', {
131 type: 'string',128 type: 'string',
132 default: null,129 default: null,
133 describe: 'Set SillyTavern to listen to a specific IPv4 address. If not set, it will fallback to listen to all.',130 describe: 'Specific IPv4 address to listen to',
134 }).option('corsProxy', {131 }).option('corsProxy', {
135 type: 'boolean',132 type: 'boolean',
136 default: null,133 default: null,
137 describe: 'Enables CORS proxy\nIf not provided falls back to yaml config \'enableCorsProxy\'',134 describe: 'Enables CORS proxy',
138 }).option('disableCsrf', {135 }).option('disableCsrf', {
139 type: 'boolean',136 type: 'boolean',
140 default: null,137 default: null,
141 describe: 'Disables CSRF protection',138 describe: 'Disables CSRF protection - NOT RECOMMENDED',
142 }).option('ssl', {139 }).option('ssl', {
143 type: 'boolean',140 type: 'boolean',
144 default: false,141 default: false,
@@ -146,11 +143,11 @@ export class CommandLineParser {
146 }).option('certPath', {143 }).option('certPath', {
147 type: 'string',144 type: 'string',
148 default: 'certs/cert.pem',145 default: 'certs/cert.pem',
149 describe: 'Path to your certificate file.',146 describe: 'Path to SSL certificate file',
150 }).option('keyPath', {147 }).option('keyPath', {
151 type: 'string',148 type: 'string',
152 default: 'certs/privkey.pem',149 default: 'certs/privkey.pem',
153 describe: 'Path to your private key file.',150 describe: 'Path to SSL private key file',
154 }).option('whitelist', {151 }).option('whitelist', {
155 type: 'boolean',152 type: 'boolean',
156 default: null,153 default: null,
@@ -162,7 +159,7 @@ export class CommandLineParser {
162 }).option('avoidLocalhost', {159 }).option('avoidLocalhost', {
163 type: 'boolean',160 type: 'boolean',
164 default: null,161 default: null,
165 describe: 'Avoids using \'localhost\' for autorun in auto mode.\nuse if you don\'t have \'localhost\' in your hosts file',162 describe: 'Avoids using \'localhost\' for autorun in auto mode.\nUse if you don\'t have \'localhost\' in your hosts file',
166 }).option('basicAuthMode', {163 }).option('basicAuthMode', {
167 type: 'boolean',164 type: 'boolean',
168 default: null,165 default: null,