parseArgs method

void parseArgs(
  1. Iterable<String>? arguments
)

Implementation

void parseArgs(Iterable<String>? arguments) {
  if (arguments == null) return;

  /// parse all args
  final result = _argParser.parse(arguments);

  /// cache directory
  if (result.wasParsed(ArgsUtils.cacheDirectory)) {
    Utils.appCacheDirectory = result[ArgsUtils.cacheDirectory];
  } else {
    Utils.appCacheDirectory = Utils.getDefaultCacheDirectory();
    Logger.i(
      "As no '${ArgsUtils.cacheDirectory}' was specified, using the default directory: ${Utils.appCacheDirectory}",
    );
  }

  /// project directory
  if (result.wasParsed(ArgsUtils.projectDirectory)) {
    Utils.projectDirectory = result[ArgsUtils.projectDirectory];
  } else {
    Utils.projectDirectory = Utils.getDefaultProjectDirectory();
    Logger.i(
      "As no '${ArgsUtils.projectDirectory}' was specified, using the current directory: ${Utils.projectDirectory}",
    );
  }

  /// quiet
  Utils.isVerbose = !result.wasParsed(ArgsUtils.quiet);

  /// use redis
  Utils.isRedisUsed = result.wasParsed(ArgsUtils.useRedis);
}