diff --git a/src/CLI/CLI.php b/src/CLI/CLI.php index c76a852..e8d5e25 100644 --- a/src/CLI/CLI.php +++ b/src/CLI/CLI.php @@ -245,7 +245,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 134bdb4..dd19071 100755 --- a/tests/CLI/CLITest.php +++ b/tests/CLI/CLITest.php @@ -258,4 +258,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); + } }