diff --git a/src/CLI/CLI.php b/src/CLI/CLI.php index 0f437e8..a1a2b14 100644 --- a/src/CLI/CLI.php +++ b/src/CLI/CLI.php @@ -244,7 +244,7 @@ public function parse(array $args): array unset($arg); foreach ($args as $arg) { - $pair = explode('=', $arg); + $pair = explode('=', $arg, 2); $key = $pair[0]; $value = $pair[1]; $output[$key][] = $value; diff --git a/tests/CLI/CLITest.php b/tests/CLI/CLITest.php index 26d61ab..a465956 100755 --- a/tests/CLI/CLITest.php +++ b/tests/CLI/CLITest.php @@ -247,4 +247,26 @@ public function testMatch() $this->assertEquals(null, $cli->match()); } + + public function testEscaping() + { + ob_start(); + + $database = 'appwrite://database_db_fra1_self_hosted_0_0?database=appwrite&namespace=_1'; + + $cli = new CLI(new Generic(), ['test.php', 'connect', '--database='.$database]); + + $cli + ->task('connect') + ->param('database', null, new Text(2048), 'Database DSN') + ->action(function ($database) { + echo $database; + }); + + $cli->run(); + + $result = ob_get_clean(); + + $this->assertEquals($database, $result); + } }