From 971586c9391e1c6c0b3f6561644d8acd05f3ae8b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 7 Sep 2016 00:27:36 +0200 Subject: [PATCH] make user URL optional in connect command --- src/shpub/Cli.php | 2 +- src/shpub/Command/Connect.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/shpub/Cli.php b/src/shpub/Cli.php index 5b46fcd..34ef479 100644 --- a/src/shpub/Cli.php +++ b/src/shpub/Cli.php @@ -146,7 +146,7 @@ class Cli $cmd->addArgument( 'user', [ - 'optional' => false, + 'optional' => true, 'description' => 'User URL', ] ); diff --git a/src/shpub/Command/Connect.php b/src/shpub/Command/Connect.php index b59de5c..68a4e18 100644 --- a/src/shpub/Command/Connect.php +++ b/src/shpub/Command/Connect.php @@ -16,6 +16,14 @@ class Command_Connect public function run($server, $user, $newKey, $force) { + $server = Validator::url($server, 'server'); + if ($user === null) { + //indieweb: homepage is your identity + $user = $server; + } else { + $user = Validator::url($user, 'user'); + } + $host = $this->getHost($newKey != '' ? $newKey : $server, $force); if ($host === null) { //already taken -- 2.30.2