From 8f135461a4e351a7bdbe182d96e44090e66c5765 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 24 Jan 2019 06:08:06 -0800 Subject: [PATCH 1/6] Fix `--size_format` argument definition. It should be `--size_format=` because it's never a flag. Also adds `--human-readable` to README docs. --- README.md | 7 +++++-- src/DB_Command.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0d3fa376a..7bb34a7a5 100644 --- a/README.md +++ b/README.md @@ -672,7 +672,7 @@ Defaults to all tables registered to the $wpdb database handler. Displays the database name and size. ~~~ -wp db size [--size_format] [--tables] [--format] [--scope=] [--network] [--all-tables-with-prefix] [--all-tables] +wp db size [--size_format=] [--tables] [--human-readable] [--format] [--scope=] [--network] [--all-tables-with-prefix] [--all-tables] ~~~ Display the database name and size for `DB_NAME` specified in wp-config.php. @@ -680,7 +680,7 @@ The size defaults to a human-readable number. **OPTIONS** - [--size_format] + [--size_format=] Display the database size only, as a bare number. --- default: b @@ -704,6 +704,9 @@ The size defaults to a human-readable number. [--tables] Display each table name and size instead of the database size. + [--human-readable] + Display database sizes in human readable formats. + [--format] table, csv, json --- diff --git a/src/DB_Command.php b/src/DB_Command.php index afcddbdfd..76117f887 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -661,7 +661,7 @@ public function tables( $args, $assoc_args ) { * * ## OPTIONS * - * [--size_format] + * [--size_format=] * : Display the database size only, as a bare number. * --- * default: b From 5d0d271a6a9dca1144a0be4ba20e28c1d3cebb2a Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 24 Jan 2019 06:39:01 -0800 Subject: [PATCH 2/6] Fix size format options definition These are also used to validate the passed value, which means they need to be bare. --- README.md | 44 ++++++++++++++++++++++++++++++-------------- src/DB_Command.php | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 7bb34a7a5..d98ce3b49 100644 --- a/README.md +++ b/README.md @@ -678,6 +678,22 @@ wp db size [--size_format=] [--tables] [--human-readable] [--format] [-- Display the database name and size for `DB_NAME` specified in wp-config.php. The size defaults to a human-readable number. +Available size formats include: +* b (bytes) +* kb (kilobytes) +* mb (megabytes) +* gb (gigabytes) +* tb (terabytes) +* B (ISO Byte setting, with no conversion) +* KB (ISO Kilobyte setting, with 1 KB = 1,000 B) +* KiB (ISO Kibibyte setting, with 1 KiB = 1,024 B) +* MB (ISO Megabyte setting, with 1 MB = 1,000 KB) +* MiB (ISO Mebibyte setting, with 1 MiB = 1,024 KiB) +* GB (ISO Gigabyte setting, with 1 GB = 1,000 MB) +* GiB (ISO Gibibyte setting, with 1 GiB = 1,024 MiB) +* TB (ISO Terabyte setting, with 1 TB = 1,000 GB) +* TiB (ISO Tebibyte setting, with 1 TiB = 1,024 GiB) + **OPTIONS** [--size_format=] @@ -685,20 +701,20 @@ The size defaults to a human-readable number. --- default: b options: - - b (bytes) - - kb (kilobytes) - - mb (megabytes) - - gb (gigabytes) - - tb (terabytes) - - B (ISO Byte setting, with no conversion) - - KB (ISO Kilobyte setting, with 1 KB = 1,000 B) - - KiB (ISO Kibibyte setting, with 1 KiB = 1,024 B) - - MB (ISO Megabyte setting, with 1 MB = 1,000 KB) - - MiB (ISO Mebibyte setting, with 1 MiB = 1,024 KiB) - - GB (ISO Gigabyte setting, with 1 GB = 1,000 MB) - - GiB (ISO Gibibyte setting, with 1 GiB = 1,024 MiB) - - TB (ISO Terabyte setting, with 1 TB = 1,000 GB) - - TiB (ISO Tebibyte setting, with 1 TiB = 1,024 GiB) + - b + - kb + - mb + - gb + - tb + - B + - KB + - KiB + - MB + - MiB + - GB + - GiB + - TB + - TiB --- [--tables] diff --git a/src/DB_Command.php b/src/DB_Command.php index 76117f887..62a63ca4f 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -659,6 +659,22 @@ public function tables( $args, $assoc_args ) { * Display the database name and size for `DB_NAME` specified in wp-config.php. * The size defaults to a human-readable number. * + * Available size formats include: + * * b (bytes) + * * kb (kilobytes) + * * mb (megabytes) + * * gb (gigabytes) + * * tb (terabytes) + * * B (ISO Byte setting, with no conversion) + * * KB (ISO Kilobyte setting, with 1 KB = 1,000 B) + * * KiB (ISO Kibibyte setting, with 1 KiB = 1,024 B) + * * MB (ISO Megabyte setting, with 1 MB = 1,000 KB) + * * MiB (ISO Mebibyte setting, with 1 MiB = 1,024 KiB) + * * GB (ISO Gigabyte setting, with 1 GB = 1,000 MB) + * * GiB (ISO Gibibyte setting, with 1 GiB = 1,024 MiB) + * * TB (ISO Terabyte setting, with 1 TB = 1,000 GB) + * * TiB (ISO Tebibyte setting, with 1 TiB = 1,024 GiB) + * * ## OPTIONS * * [--size_format=] @@ -666,20 +682,20 @@ public function tables( $args, $assoc_args ) { * --- * default: b * options: - * - b (bytes) - * - kb (kilobytes) - * - mb (megabytes) - * - gb (gigabytes) - * - tb (terabytes) - * - B (ISO Byte setting, with no conversion) - * - KB (ISO Kilobyte setting, with 1 KB = 1,000 B) - * - KiB (ISO Kibibyte setting, with 1 KiB = 1,024 B) - * - MB (ISO Megabyte setting, with 1 MB = 1,000 KB) - * - MiB (ISO Mebibyte setting, with 1 MiB = 1,024 KiB) - * - GB (ISO Gigabyte setting, with 1 GB = 1,000 MB) - * - GiB (ISO Gibibyte setting, with 1 GiB = 1,024 MiB) - * - TB (ISO Terabyte setting, with 1 TB = 1,000 GB) - * - TiB (ISO Tebibyte setting, with 1 TiB = 1,024 GiB) + * - b + * - kb + * - mb + * - gb + * - tb + * - B + * - KB + * - KiB + * - MB + * - MiB + * - GB + * - GiB + * - TB + * - TiB * --- * * [--tables] From a1849d98f92e7b5473be83b30b9a8160e5bdc502 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 24 Jan 2019 06:41:31 -0800 Subject: [PATCH 3/6] YAML doc needs to be two spaces, not one. --- README.md | 30 +++++++++++++++--------------- src/DB_Command.php | 30 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index d98ce3b49..deffd342a 100644 --- a/README.md +++ b/README.md @@ -701,21 +701,21 @@ Available size formats include: --- default: b options: - - b - - kb - - mb - - gb - - tb - - B - - KB - - KiB - - MB - - MiB - - GB - - GiB - - TB - - TiB - --- + - b + - kb + - mb + - gb + - tb + - B + - KB + - KiB + - MB + - MiB + - GB + - GiB + - TB + - TiB + --- [--tables] Display each table name and size instead of the database size. diff --git a/src/DB_Command.php b/src/DB_Command.php index 62a63ca4f..fe32ca30e 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -682,21 +682,21 @@ public function tables( $args, $assoc_args ) { * --- * default: b * options: - * - b - * - kb - * - mb - * - gb - * - tb - * - B - * - KB - * - KiB - * - MB - * - MiB - * - GB - * - GiB - * - TB - * - TiB - * --- + * - b + * - kb + * - mb + * - gb + * - tb + * - B + * - KB + * - KiB + * - MB + * - MiB + * - GB + * - GiB + * - TB + * - TiB + * --- * * [--tables] * : Display each table name and size instead of the database size. From e71a84f0ced7401b2749bdbdc477f75ee389ca43 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 24 Jan 2019 06:42:15 -0800 Subject: [PATCH 4/6] Fix argument format for `--format=`. It's not a flag --- README.md | 7 ++++--- src/DB_Command.php | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index deffd342a..2d5369ede 100644 --- a/README.md +++ b/README.md @@ -672,7 +672,7 @@ Defaults to all tables registered to the $wpdb database handler. Displays the database name and size. ~~~ -wp db size [--size_format=] [--tables] [--human-readable] [--format] [--scope=] [--network] [--all-tables-with-prefix] [--all-tables] +wp db size [--size_format=] [--tables] [--human-readable] [--format=] [--scope=] [--network] [--all-tables-with-prefix] [--all-tables] ~~~ Display the database name and size for `DB_NAME` specified in wp-config.php. @@ -723,14 +723,15 @@ Available size formats include: [--human-readable] Display database sizes in human readable formats. - [--format] - table, csv, json + [--format=] + Render output in a particular format. --- default: table options: - table - csv - json + - yaml --- [--scope=] diff --git a/src/DB_Command.php b/src/DB_Command.php index fe32ca30e..27e6225ec 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -704,14 +704,15 @@ public function tables( $args, $assoc_args ) { * [--human-readable] * : Display database sizes in human readable formats. * - * [--format] - * : table, csv, json + * [--format=] + * : Render output in a particular format. * --- * default: table * options: * - table * - csv * - json + * - yaml * --- * * [--scope=] From b6b72983239f55f9f5da8a93ab13dc4116d21556 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 24 Jan 2019 07:19:09 -0800 Subject: [PATCH 5/6] Remove default value for `--size_format=` Otherwise, it's included all of the time, which isn't expected. --- README.md | 1 - src/DB_Command.php | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 2d5369ede..d90bff29e 100644 --- a/README.md +++ b/README.md @@ -699,7 +699,6 @@ Available size formats include: [--size_format=] Display the database size only, as a bare number. --- - default: b options: - b - kb diff --git a/src/DB_Command.php b/src/DB_Command.php index 27e6225ec..f30ca7ff7 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -680,7 +680,6 @@ public function tables( $args, $assoc_args ) { * [--size_format=] * : Display the database size only, as a bare number. * --- - * default: b * options: * - b * - kb From 43cd750c77b1c71be2e7db1ecbc958c54f16c8da Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Thu, 24 Jan 2019 07:53:26 -0800 Subject: [PATCH 6/6] Default format is actually a number, not `--format=table` --- README.md | 1 - src/DB_Command.php | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 41ab0e31a..ce140b070 100644 --- a/README.md +++ b/README.md @@ -738,7 +738,6 @@ Available size formats include: [--format=] Render output in a particular format. --- - default: table options: - table - csv diff --git a/src/DB_Command.php b/src/DB_Command.php index f30ca7ff7..870a0247e 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -706,7 +706,6 @@ public function tables( $args, $assoc_args ) { * [--format=] * : Render output in a particular format. * --- - * default: table * options: * - table * - csv