suggested syntax for channels
| From: | Greg Beaver | Date: | Sun, 19 Sep 2004 23:52:46 +0000 |
| Subject: | suggested syntax for channels | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-33460@lists.php.net to get a copy of this message | ||
Hi,
Since many channel names will be their hosts (this is always a good idea), I'm thinking it would be best to do channel/package ID like so:
$ pear install Foo
install of channel://pear.php.net/Foo 1.3.0 OK
This uses default_channel
$ pear install pear.php.net/Foo
install of channel://pear.php.net/Foo 1.3.0 OK
channel is explicit here, but there is a risk that a file named "pear.php.net/Foo" exists, so then you can do the full
$ pear install channel://pear.php.net/Foo
install of channel://pear.php.net/Foo 1.3.0 OK
this also means
$ pear install channel://user:pass@pear.php.net/Foo
syntax becomes possible and parse_url is at our disposal
It also means that if a channel is not found, rather than erroring out, an attempt to auto-discover can be made
$ pear install pear.chiaraquartet.net/Foo
Channel pear.chiaraquartet.net is not initialized, use "pear discover pear.chiaraquartet.net" to initialize
this is assuming that pear.chiaraquartet.net/channel.xml exists and is a valid channel.xml
$ pear install pear.chiaraquartet.net/Foo
pear.chiaraquartet.net is not a valid channel
this one is what users see if the channel.xml cannot be found.
This also means that future options can be added as extra path arguments
$ pear install channel://pear.chiaraquartet.net/Foo/group=Bar
Since the thing is a url, it also means previously non-legal characters can be used as url-encoded values.
secchannel:// could be used for channels that support SSL (or something like that, "secchannel" could be "secure" or "schannel" even).
The only other adjustment needed is a new field in channel.xml for channel prefix. This field can be used to describe to users what class prefixes need to be, as well as what aliases can be used.
<prefix>pear</prefix>
this would allow
$ pear install pear/Foo
install of pear.chiaraquartet.net/Foo 1.3.0 OK
If there is a conflict, a local re-assignment can be made by modifying the registry so that it was as if the original channel.xml had:
<prefix local="my">pear</prefix>
$ pear alias pear.chiaraquartet.net my
now using "my" as the shortcut prefix for pear.chiaraquartet.net
Greg