DownloadImagesFromArgsCommand constructor

DownloadImagesFromArgsCommand({
  1. required FigmaService figmaApi,
  2. required ParserService parser,
  3. required WriterService writer,
  4. required CodeGeneratorService generator,
  5. required LoggerService logger,
})

Implementation

DownloadImagesFromArgsCommand({
  required this.figmaApi,
  required this.parser,
  required this.writer,
  required this.generator,
  required this.logger,
}) {
  argParser.addOption(
    'fileId',
    mandatory: true,
    help: 'The id of the figma file, can be found in the URL.',
  );
  argParser.addOption(
    'token',
    mandatory: true,
    help: 'Your Figma personal access token.',
  );
  argParser.addOption(
    'outputFolder',
    mandatory: false,
    defaultsTo: 'assets',
    help: 'Folder for the downloaded images, defaults to /assets.',
  );
  argParser.addOption(
    'scale',
    mandatory: false,
    defaultsTo: '1.0,2.0,3.0',
    help:
        'Specify the scales of images to download (comma-separated), must be a number between 0.01 and 4. Defaults to 1.0,2.0,3.0. Warning: The "scale" argument is ignored for SVG format.',
  );
  argParser.addOption('format',
      mandatory: false,
      defaultsTo: 'png',
      allowed: ['jpg', 'png', 'svg'],
      help: 'Format of the downloaded images, defaults to png.');
  argParser.addOption('section',
      mandatory: false,
      defaultsTo: 'APP_ASSET_',
      help:
          r'Specify sections to download (comma-separated), defaults to all APP_ASSET_$section sections.');
  argParser.addFlag('force',
      defaultsTo: false,
      help:
          'Force download the images even if they already exist, defaults to false.');
}