From b62ce9322785fd218dcacfa9c909bdaead13c3c8 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Thu, 13 Aug 2020 15:35:05 +0200 Subject: [PATCH 1/2] fix(tric-stack.yml) update the WordPress version to 5.5 --- changelog.md | 5 +++++ tric | 2 +- tric-stack.yml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index aef3782..118e95b 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.3] - 2020-08-13 +### Changed + +- Update the WordPress version used in the stack to `5.5`. + ## [0.5.2] - 2020-08-10 ### Changed diff --git a/tric b/tric index fdd8e58..8d711d1 100755 --- a/tric +++ b/tric @@ -25,7 +25,7 @@ $args = args( [ ] ); $cli_name = basename( $argv[0] ); -const CLI_VERSION = '0.5.2'; +const CLI_VERSION = '0.5.3'; $cli_header = implode( ' - ', [ light_cyan( $cli_name ) . ' version ' . light_cyan( CLI_VERSION ), diff --git a/tric-stack.yml b/tric-stack.yml index 471655f..9e96371 100644 --- a/tric-stack.yml +++ b/tric-stack.yml @@ -24,7 +24,7 @@ services: wordpress: # Fix the version of the WordPress image to avoid issues w/ out-of-date database dumps. - image: wordpress:5.4.1-apache + image: wordpress:5.5-apache networks: tric: # Allow the other containers to read this container with a pretty URL. From 137b1efd6851cb91d8b2f185645decdbd7f4e38d Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Mon, 17 Aug 2020 11:15:33 +0200 Subject: [PATCH 2/2] fix(utils.php) handling of prompt default answers --- changelog.md | 1 + src/utils.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/changelog.md b/changelog.md index 118e95b..238b84b 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Update the WordPress version used in the stack to `5.5`. +- Fix handling of default answers in prompts. ## [0.5.2] - 2020-08-10 ### Changed diff --git a/src/utils.php b/src/utils.php index 6aa6367..89ca591 100644 --- a/src/utils.php +++ b/src/utils.php @@ -497,6 +497,9 @@ function ask( $question, $default = null ) { $prompt .= " ({$default})"; } + // Add an empty space after the prompt to separate visual confusion. + $prompt .= ' '; + $is_boolean = false; if ( is_bool( $default ) || preg_match( '/(^yes|no)$/i', $default ) ) { // It's a yes or no question, cast to boolean at the end. @@ -511,6 +514,13 @@ function ask( $question, $default = null ) { $value = readline(); } + /* + * If the answer is an empty line, then the user just pressed Enter: use the default value. + */ + if ( $default !== '' ) { + $value = '' === trim( $value ) ? $default : $value; + } + if ( $is_boolean ) { return preg_match( '/^y/i', $value ); }