validate method

FutureOr<ExitCode?> validate(
  1. List<String>? keys
)

Implementation

FutureOr<ExitCode?> validate(List<String>? keys) async {
  if (keys == null || keys.isEmpty) {
    const warning = 'No script specified, choose from:';
    logger
      ..warn(lightYellow.wrap(warning))
      ..write('\n');

    return ListCommand(
      scriptsYaml: scriptsYaml,
      logger: logger,
    ).run();
  }

  if (keys.any((e) => e.startsWith('_'))) {
    logger.err(
      r'''
Private scripts are not intended to be invoked, only to be used as a references in other scripts.

```yaml
format:
_: dart format .
ui: cd packages/ui && {$format:_}
```

$ sip format ui
''',
    );
    return ExitCode.config;
  }

  return null;
}