Skip to content

Commit

Permalink
docs(dev): improve help messages for component-info command
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Dec 17, 2024
1 parent 70dd30d commit 46be478
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions dev/src/Command/ComponentInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,26 @@ protected function configure()
->addOption('component', 'c', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'get info for a single component', [])
->addOption('csv', '', InputOption::VALUE_OPTIONAL, 'export findings to csv.', false)
->addOption('fields', 'f', InputOption::VALUE_REQUIRED, sprintf(
"Comma-separated list of fields, \"all\" for all fields. The following fields are available: \n - %s\n" .
"NOTE: \"available_api_versions\", \"created_at\", and \"downloads\" are omited by default because they ".
"take a long time to load.\n",
'Comma-separated list of fields. Prefix with "+" to add to default filters, or use "all" for all fields.'
. " The following fields are available: \n - %s\n"
. "\n EXAMPLE: --fields 'component_name,package_version,api_version'"
. "\n EXAMPLE: --fields '+migration_mode'"
. "\n EXAMPLE: --fields all"
. "\nNOTE: \"available_api_versions\", \"created_at\", and \"downloads\" are omited by default because they "
. "take a long time to load.",
implode("\n - ", array_keys(self::$allFields))
))
->addOption('filter', '', InputOption::VALUE_REQUIRED,
'Comma-separated list of key-value filters. Supported operators are "=", "!=", "~=", and "!~=".'
. "\nExample: `--filter 'release_level=preview,migration_mode~=NEW_SURFACE_ONLY,migration_mode!~=MIGRATING'`'"
'Comma-separated list of key-value filters.'
. "\nSupported operators are \"=\", \"!=\", \"~=\", and \"!~=\"."
. "\nEXAMPLE: --filter 'release_level=preview,migration_mode~=NEW_SURFACE_ONLY,migration_mode!~=MIGRATING'"
)
->addOption('sort', '', InputOption::VALUE_REQUIRED,
'field to sort by (with optional ASC/DESC suffix. e.g. "component_name DESC"'
)
->addOption('token', 't', InputOption::VALUE_REQUIRED, 'Github token to use for authentication', '')
->addOption('expanded', '', InputOption::VALUE_NONE, 'Break down each component by packages')
->addOption('count', '', InputOption::VALUE_NONE, 'output number of components which match the provided filters')
->addOption('expanded', '', InputOption::VALUE_NONE, 'Gives each component version its own row')
->addOption('token', 't', InputOption::VALUE_REQUIRED, 'Github token to use for authentication. Used to prevent Github rate limiting.', '')
;
}

Expand Down Expand Up @@ -154,6 +160,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

if ($input->getOption('count')) {
$output->writeln(count($rows));
return 0;
}

// output the component data
$headers = array_values(array_replace(
$requestedFields,
Expand Down

0 comments on commit 46be478

Please sign in to comment.