PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PEAR » PEAR » Bug #3213

patch: PEAR/Frontend/CLI.php - sort remote-list

Details

Request #3213patch: PEAR/Frontend/CLI.php - sort remote-list
Submitted2005-01-15 17:48 UTC
Fromsdibb at myway dot com
StatusClosed
PackagePEAR
PHP Version5.0.3
OSGNU/Linux
Roadmaps(Not assigned)

Comments

[2005-01-15 17:48 UTC] sdibb at myway dot com

Description:
------------
Okay this has been bothering me for a while, so I finally created a simple patch to PEAR so that remote-list sorts alphabetically. :)

Reproduce code:
---------------
===================================================================
RCS file: ./RCS/CLI.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
19c19
< $Id: CLI.php,v 1.1 2005/01/15 17:36:59 steve Exp $
---
> $Id: CLI.php,v 1.2 2005/01/15 17:45:31 steve Exp $
410c410
< $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
---
> $list[] = $pkg;
412a413,420
>
> function cmp($a, $b) {
> return strcmp(strtolower($a), strtolower($b));
> }
> usort($list, "cmp");
> foreach($list as $pkg) {
> $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
> }

[2005-01-15 17:58 UTC] sdibb at myway dot com

better yet:

===================================================================
RCS file: ./RCS/CLI.php,v
retrieving revision 1.1
retrieving revision 1.3
diff -r1.1 -r1.3
19c19
< $Id: CLI.php,v 1.1 2005/01/15 17:36:59 steve Exp $
---
> $Id: CLI.php,v 1.3 2005/01/15 17:58:20 steve Exp $
410c410
< $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
---
> $list[] = $pkg;
412a413,417
>
> natcasesort($list);
> foreach($list as $pkg) {
> $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
> }

[2005-01-17 15:55 UTC] sdibb at myway dot com

Greg,

Thanks for letting me know. For the record, I goofed on the subject. I meant to say list-all, not remote-list. And then I tested the patch, and while it worked at one point, later I couldn't get it to sort without NOTICE errors.

The spirit is willing... :)

Anyway, glad it's fixed in CVS. And yes, I'm hoping I can help out. There's still a few more bugs I'd like to fix. ;)

Just recently joined the developers list too. See you around!

Steve