docs: function finalizeCliOptions(errstream, options, env) {
      /*
       * Independent of anything else, if the user specified a bootstrap domain in
       * the environment and didn't specify it on the CLI, incorporate that here.
       */
      if ((!options.hasOwnProperty('cueballOptions') ||
          !options.cueballOptions.hasOwnProperty('resolvers')) &&
          env['MORAY_BOOTSTRAP_DOMAIN']) {
          if (!options.hasOwnProperty('cueballOptions')) {
              options.cueballOptions = {};
          }
  
          options.cueballOptions.resolvers = [ env['MORAY_BOOTSTRAP_DOMAIN'] ];
      }
  
      if (options.srvDomain !== undefined) {
          /* The user specified -s/--service. */
          if (options.port !== undefined || options.host !== undefined) {
              fprintf(errstream, '-S/--service cannot be combined with ' +
                  '-h/--host or -p/--port\n');
              return (false);
          }
  
          return (true);
      }
  
      if (options.host !== undefined && options.port !== undefined) {
          /* The user specified both -h/--host and -p/--port. */
          return (true);
      }
  
      if (options.host !== undefined || options.port !== undefined) {
          /*
           * The user specified one -h/--host and -p/--port.  Assume they want the
           * direct mode and fill in the other option from MORAY_URL or our
           * built-in default values.
           */
          return (populateDirectArguments(errstream, options, env));
      }
  
      /*
       * The user specified nothing on the command line.  Check for MORAY_SERVICE.
       */
      if (env['MORAY_SERVICE']) {
          if (!validateSrvDomain(errstream, env['MORAY_SERVICE'])) {
              return (false);
          }
  
          options.srvDomain = env['MORAY_SERVICE'];
          return (true);
      }
  
      /*
       * If we get this far, all that's left to try is MORAY_URL, then fall back
       * to built-in defaults.
       */
      return (populateDirectArguments(errstream, options, env));
  }