Rewrite comments
| @@ -34,12 +34,8 @@ import { canResolve, color, getConfigValue, stringToBool } from './util.js'; | ||
| 34 | 34 | */ |
| 35 | 35 | |
| 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 | - | |
| 43 | 39 | export class CommandLineParser { |
| 44 | 40 | constructor() { |
| 45 | 41 | /** @type {CommandLineArguments} */ |
| @@ -85,32 +81,33 @@ export class CommandLineParser { | ||
| 85 | 81 | |
| 86 | 82 | /** |
| 87 | 83 | * Parses command line arguments. |
| 84 | + * Arguments that are not provided will be filled with config values. | |
| 88 | 85 | * @param {string[]} args Process startup arguments. |
| 89 | 86 | * @returns {CommandLineArguments} Parsed command line arguments. |
| 90 | 87 | */ |
| 91 | 88 | parse(args) { |
| 92 | 89 | const cliArguments = yargs(hideBin(args)) |
| 93 | 90 | .usage('Usage: <your-start-script> <command> [options]\nOptions that are not provided will be filled with config values.') |
| 94 | 91 | .option('enableIPv6', { |
| 95 | 92 | type: 'string', |
| 96 | 93 | default: null, |
| 97 | 94 | describe: 'Enables IPv6 protocol.', |
| 98 | 95 | }).option('enableIPv4', { |
| 99 | 96 | type: 'string', |
| 100 | 97 | default: null, |
| 101 | 98 | describe: 'Enables IPv4 protocol.', |
| 102 | 99 | }).option('port', { |
| 103 | 100 | type: 'number', |
| 104 | 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 | 103 | }).option('dnsPreferIPv6', { |
| 107 | 104 | type: 'boolean', |
| 108 | 105 | default: null, |
| 109 | 106 | describe: 'Prefers IPv6 for DNS\nyounYou should probably have the enabled if you\'re on an IPv6 only network\nIf not provided falls back to yaml config \'dnsPreferIPv6\'.', |
| 110 | 107 | }).option('autorun', { |
| 111 | 108 | type: 'boolean', |
| 112 | 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 | 111 | }).option('autorunHostname', { |
| 115 | 112 | type: 'string', |
| 116 | 113 | default: null, |
| @@ -122,23 +119,23 @@ export class CommandLineParser { | ||
| 122 | 119 | }).option('listen', { |
| 123 | 120 | type: 'boolean', |
| 124 | 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 | 123 | }).option('listenAddressIPv6', { |
| 127 | 124 | type: 'string', |
| 128 | 125 | default: null, |
| 129 | 126 | describe: 'Set SillyTavern to listen to a specificSpecific IPv6 address. If not set, it will fallback to listen to all.', |
| 130 | 127 | }).option('listenAddressIPv4', { |
| 131 | 128 | type: 'string', |
| 132 | 129 | default: null, |
| 133 | 130 | describe: 'Set SillyTavern to listen to a specificSpecific IPv4 address. If not set, it will fallback to listen to all.', |
| 134 | 131 | }).option('corsProxy', { |
| 135 | 132 | type: 'boolean', |
| 136 | 133 | default: null, |
| 137 | 134 | describe: 'Enables CORS proxy\nIf not provided falls back to yaml config \'enableCorsProxy\'', |
| 138 | 135 | }).option('disableCsrf', { |
| 139 | 136 | type: 'boolean', |
| 140 | 137 | default: null, |
| 141 | 138 | describe: 'Disables CSRF protection - NOT RECOMMENDED', |
| 142 | 139 | }).option('ssl', { |
| 143 | 140 | type: 'boolean', |
| 144 | 141 | default: false, |
| @@ -146,11 +143,11 @@ export class CommandLineParser { | ||
| 146 | 143 | }).option('certPath', { |
| 147 | 144 | type: 'string', |
| 148 | 145 | default: 'certs/cert.pem', |
| 149 | 146 | describe: 'Path to yourSSL certificate file.', |
| 150 | 147 | }).option('keyPath', { |
| 151 | 148 | type: 'string', |
| 152 | 149 | default: 'certs/privkey.pem', |
| 153 | 150 | describe: 'Path to yourSSL private key file.', |
| 154 | 151 | }).option('whitelist', { |
| 155 | 152 | type: 'boolean', |
| 156 | 153 | default: null, |
| @@ -162,7 +159,7 @@ export class CommandLineParser { | ||
| 162 | 159 | }).option('avoidLocalhost', { |
| 163 | 160 | type: 'boolean', |
| 164 | 161 | default: null, |
| 165 | 162 | describe: 'Avoids using \'localhost\' for autorun in auto mode.\nusenUse if you don\'t have \'localhost\' in your hosts file', |
| 166 | 163 | }).option('basicAuthMode', { |
| 167 | 164 | type: 'boolean', |
| 168 | 165 | default: null, |