cli
cli copied to clipboard
CLI-980: Fix argument / options order in API usage examples
For commands like api:environments:certificate-create
, Symfony correctly extrapolates usage from the InputDefinition:
api:environments:certificate-create [options] [--] <environmentId> <certificate> <private_key>
Basically, the ordering here is (1) options (2) end-of-options marker (--
) (3) arguments.
The problem is that we construct our own usage examples based on the API spec and they are all out of order, such as:
api:environments:certificate-create 12-d314739e-296f-11e9-b210-d663bd873d93 --legacy="" "-----BEGIN CERTIFICATE-----abc123....-----END CERTIFICATE-----" "-----BEGIN RSA PRIVATE KEY-----secret....-----END RSA PRIVATE KEY-----" --ca_certificates="-----BEGIN CERTIFICATE-----123abc....-----END CERTIFICATE-----" --csr_id="123" --label="My New Cert"
Notice that some arguments come before options, which is especially bad if your arguments contains the end-of-options marker, as in this case.
While we could fix this... given all of the other problems with dumping multiple thousands of characters into command-line parameters... a better fix is probably to take certificate filenames as arguments.