Misc edits in texts and output

This commit is contained in:
Anthony Axenov 2023-08-13 23:42:24 +08:00
parent 1ebdffe2a6
commit 44f437eaf3
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
3 changed files with 13 additions and 16 deletions

View File

@ -32,7 +32,7 @@ These formats are supported for now: `http`, `curl`, `wget`.
- tests, phpcs, psalm, etc.; - tests, phpcs, psalm, etc.;
- web version. - web version.
## Installation ## Install and upgrade
``` ```
composer global r axenov/pm-convert composer global r axenov/pm-convert

View File

@ -1,7 +1,7 @@
{ {
"name": "axenov/pm-convert", "name": "axenov/pm-convert",
"type": "library", "type": "library",
"description": "Postman collection coverter", "description": "Postman collection converter",
"license": "MIT", "license": "MIT",
"homepage": "https://axenov.dev/", "homepage": "https://axenov.dev/",
"authors": [ "authors": [

View File

@ -7,16 +7,15 @@ namespace PmConverter;
use Exception; use Exception;
use InvalidArgumentException; use InvalidArgumentException;
use JsonException; use JsonException;
use PmConverter\Exceptions\CannotCreateDirectoryException; use PmConverter\Exceptions\{
use PmConverter\Exceptions\DirectoryIsNotReadableException; CannotCreateDirectoryException,
use PmConverter\Exceptions\DirectoryIsNotWriteableException; DirectoryIsNotReadableException,
use PmConverter\Exceptions\DirectoryNotExistsException; DirectoryIsNotWriteableException,
use PmConverter\Exporters\ConverterContract; DirectoryNotExistsException};
use PmConverter\Exporters\ConvertFormat; use PmConverter\Exporters\{
ConverterContract,
ConvertFormat};
/**
*
*/
class Processor class Processor
{ {
/** /**
@ -89,9 +88,6 @@ class Processor
* Parses an array of arguments came from cli * Parses an array of arguments came from cli
* *
* @return void * @return void
* @throws DirectoryIsNotWriteableException
* @throws DirectoryNotExistsException
* @throws DirectoryIsNotReadableException
*/ */
protected function parseArgs(): void protected function parseArgs(): void
{ {
@ -285,7 +281,7 @@ class Processor
{ {
$time = (hrtime(true) - $this->initTime) / 1_000_000; $time = (hrtime(true) - $this->initTime) / 1_000_000;
$ram = (memory_get_peak_usage(true) - $this->initRam) / 1024 / 1024; $ram = (memory_get_peak_usage(true) - $this->initRam) / 1024 / 1024;
printf('Converted %d of %d in %.3f ms using %.3f MiB RAM', $success, $count, $time, $ram); printf('Converted %d of %d in %.3f ms using %.3f MiB RAM%s', $success, $count, $time, $ram, PHP_EOL);
} }
/** /**
@ -321,7 +317,7 @@ class Processor
'', '',
'Possible ARGUMENTS:', 'Possible ARGUMENTS:',
"\t-f, --file - a PATH to single collection located in PATH to convert from", "\t-f, --file - a PATH to single collection located in PATH to convert from",
"\t-d, --dir - a directory with collections located in COLLECTION_FILEPATH to convert from", "\t-d, --dir - a directory with collections located in PATH to convert from",
"\t-o, --output - a directory OUTPUT_PATH to put results in", "\t-o, --output - a directory OUTPUT_PATH to put results in",
"\t-e, --env - use environment file with variable values to replace in request", "\t-e, --env - use environment file with variable values to replace in request",
"\t-p, --preserve - do not delete OUTPUT_PATH (if exists)", "\t-p, --preserve - do not delete OUTPUT_PATH (if exists)",
@ -341,6 +337,7 @@ class Processor
"\t--http - generate raw *.http files (default)", "\t--http - generate raw *.http files (default)",
"\t--curl - generate shell scripts with curl command", "\t--curl - generate shell scripts with curl command",
"\t--wget - generate shell scripts with wget command", "\t--wget - generate shell scripts with wget command",
'',
'If no FORMATS specified then --http implied.', 'If no FORMATS specified then --http implied.',
'Any of FORMATS can be specified at the same time.', 'Any of FORMATS can be specified at the same time.',
'', '',