From 5af8236a151004c1c538c377bbf6a37c64407402 Mon Sep 17 00:00:00 2001 From: Jason Adams Date: Wed, 4 Jan 2023 16:45:49 -0800 Subject: [PATCH] refactor: remove unnecessary confirmation --- bin/set-domain | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/bin/set-domain b/bin/set-domain index 6e7aa6d..22ae5cf 100755 --- a/bin/set-domain +++ b/bin/set-domain @@ -11,20 +11,10 @@ function ask( string $question, string $default = '' ): string { return $answer; } -function confirm( string $question, bool $default = false ): bool { - $answer = ask( $question . ' (' . ( $default ? 'Y/n' : 'y/N' ) . ')' ); - - if ( ! $answer ) { - return $default; - } - - return strtolower( $answer ) === 'y'; -} - function replace_in_file( string $file, array $replacements ) { $contents = file_get_contents( $file ); - $success = file_put_contents( + file_put_contents( $file, str_replace( array_keys( $replacements ), @@ -51,10 +41,6 @@ if ( empty( $domain ) ) { exit( 0 ); } -if ( ! confirm( 'Modify files?', true ) ) { - exit( 1 ); -} - $files = explode( PHP_EOL, run( 'grep -E -r -l -i "%TEXTDOMAIN%" ' . dirname( __FILE__, 2 ) . '/src' ) ); $files = array_filter( $files );