threads / patch / 1115

patchAdd commify function to cg-Xlib

Subject: [PATCH] Add commify function to cg-Xlib

## tl;dr

4 messages between Jul 6, 2005 and Jul 6, 2005. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Frank Sorenson· Jul 6, 2005, 07:00 UTC · lore
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here is a patch to add a commify function to cg-Xlib. I'll follow this up with a patch that uses the new function to commify the number and size of objects pulled in cg-pull.

Signed-off-by: Frank Sorenson <frank@tuxrocks.com>
Add a commify function to cg-Xlib
- ---
commit de4fd646c8307777137b9a4c1b5735f9573167f6
tree 1b9d3d0db498fde457d60f6658f616a1aa6b9fe3
parent b21855b8734ca76ea08c0c17e4a204191b6e3add
author Frank Sorenson <frank@tuxrocks.com> Wed, 06 Jul 2005 00:38:16 -0600
committer Frank Sorenson <frank@tuxrocks.com> Wed, 06 Jul 2005 00:38:16 -0600
 cg-Xlib |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to cg-Xlib +3 −2
diff --git a/cg-Xlib b/cg-Xlib
- --- a/cg-Xlib
+++ b/cg-Xlib
@@ -128,6 +128,9 @@ update_index () {
 	git-update-cache --refresh | sed 's/needs update$/locally modified/'
 }
 
+commify() {
+	echo $1 | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta'
+}
 
 print_help () {
 	which "cg-$1" >/dev/null 2>&1 || exit 1


Frank
- -- 
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCy4GiaI0dwg4A47wRAg+vAJ9ZCn7ptBARMY+ELyS+uQ893/aDLgCgsk8b
dhfcgflxQRURowVFP2qiRe4=
=u7ap
-----END PGP SIGNATURE-----
Frank Sorenson· Jul 6, 2005, 07:04 UTC · re: Frank Sorenson · lore

[PATCH] Commify numbers in cg-pull

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here is a patch to commify the number and size of objects pulled in cg-pull. Depends on the previous "Add commify function" patch.

Signed-off-by: Frank Sorenson <frank@tuxrocks.com>
Commify number and size of objects pulled in pull_progress
- ---
commit 03fb604eb8c24851096cca14bed19f4eacc79686
tree 191e8aa3a034e302aa660a9a5b5c0c64e2e88ac9
parent de4fd646c8307777137b9a4c1b5735f9573167f6
author Frank Sorenson <frank@tuxrocks.com> Wed, 06 Jul 2005 00:47:56 -0600
committer Frank Sorenson <frank@tuxrocks.com> Wed, 06 Jul 2005 00:47:56 -0600
 cg-pull |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to cg-pull +1 −3
diff --git a/cg-pull b/cg-pull
- --- a/cg-pull
+++ b/cg-pull
@@ -82,7 +82,7 @@ pull_progress() {
 		size=$(($size + $(stat -c '%s' "$object" 2>/dev/null)))
 		objects=$(($objects + 1));
 
- -		echo -ne "progress: $objects objects, $size bytes$percentage\r"
+		echo -ne "progress: $(commify $objects) objects, $(commify $size) bytes$percentage\r"
 	done;
 	[ "$last_objects" != "$objects" ] && echo
 }


Frank
- -- 
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCy4J4aI0dwg4A47wRAihxAKCOAioNWvYBDPkOvk/hYUgfUuMdewCgm1ea
4IGx09Ew6tytbOAyPrUxHZU=
=YM7f
-----END PGP SIGNATURE-----
Petr Baudis· Jul 6, 2005, 07:59 UTC · re: Frank Sorenson · lore

Re: [PATCH] Add commify function to cg-Xlib

Dear diary, on Wed, Jul 06, 2005 at 09:00:50AM CEST, I got a letter where Frank Sorenson <frank@tuxrocks.com> told me that...

Show 5 quoted lines
> Here is a patch to add a commify function to cg-Xlib.  I'll follow 
> this up with a patch that uses the new function to commify the 
> number and size of objects pulled in cg-pull.
> 
> Signed-off-by: Frank Sorenson <frank@tuxrocks.com>

I don't know. Could you give some supporting argumentation, please? Is it really that hard to read for the Americans without the commas? It is at least harder to read for me as an European - we don't have any commas in there, just spaces (if anything at all). Besides, the number is usually not in higher order than thousands, so... why is it worth it?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
<Espy> be careful, some twit might quote you out of context..
Frank Sorenson· Jul 6, 2005, 17:57 UTC · re: Petr Baudis · lore

Re: [PATCH] Add commify function to cg-Xlib

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Petr Baudis wrote:
Show 5 quoted lines
> I don't know. Could you give some supporting argumentation, please? Is
> it really that hard to read for the Americans without the commas? It is
> at least harder to read for me as an European - we don't have any
> commas in there, just spaces (if anything at all). Besides, the number
> is usually not in higher order than thousands, so... why is it worth it?

Okay. Not a problem. It just cleaned things up a little for me. If I want to keep it, I'll probably just maintain it in my local tree.

Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCzBumaI0dwg4A47wRAmKKAJ90HJymEjSHwvpKq7pjQkXf9wz7sACfXl8F BttVqvdhovFaGYEn9PibeC0= =N90S -----END PGP SIGNATURE-----

← back to recent threads