summaryrefslogtreecommitdiffstats
path: root/src/pacman/trans.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-10-31 07:41:42 +0100
committerAaron Griffin <aaron@archlinux.org>2006-10-31 07:41:42 +0100
commit5a8bbc99be0ec8ea264fca061276e9ec798bca5e (patch)
tree0107af1d7d04ba0d67d6cf69d0b8bf1746f6137f /src/pacman/trans.c
parentaf2fb3324a925af6caa9d53aacac92173fc47885 (diff)
downloadpacman-5a8bbc99be0ec8ea264fca061276e9ec798bca5e.tar.gz
pacman-5a8bbc99be0ec8ea264fca061276e9ec798bca5e.tar.xz
Numerous changes:
* Added 'ILoveCandy' support to all progress bars * Changed download callback with regards to libfetch libalpm changes * libfetch error output on failed sync * Misc others I may have forgot to name (check the diff, heh)
Diffstat (limited to 'src/pacman/trans.c')
-rw-r--r--src/pacman/trans.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index 29e55791..2fffcb18 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -288,9 +288,11 @@ void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, i
void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain)
{
+ static int lasthash = 0, mouth = 0;
int i, hash;
+ long chomp = 0;
unsigned int maxpkglen, progresslen = maxcols - 57;
- char *addstr, *upgstr, *removestr, *conflictstr, *ptr;
+ char *addstr, *upgstr, *removestr, *conflictstr, *ptr = NULL;
addstr = strdup(_("installing"));
upgstr = strdup(_("upgrading"));
removestr = strdup(_("removing"));
@@ -355,14 +357,45 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
break;
}
+ alpm_get_option(PM_OPT_CHOMP, &chomp);
+
+ /* hide the cursor, prevent flicker during fancy graphics
+ printf("\033[?25l\033[?1c[");
+ */
printf("[");
- for (i = progresslen; i > 0; i--) {
- if (i >= progresslen - hash)
+ for(i = progresslen; i > 0; --i) {
+ if(chomp) {
+ if(i > progresslen - hash) {
+ printf("-");
+ } else if(i == progresslen - hash) {
+ if(lasthash == hash) {
+ if(mouth) {
+ printf("\033[1;33mC\033[m");
+ } else {
+ printf("\033[1;33mc\033[m");
+ }
+ } else {
+ lasthash = hash;
+ mouth = mouth == 1 ? 0 : 1;
+ if(mouth) {
+ printf("\033[1;33mC\033[m");
+ } else {
+ printf("\033[1;33mc\033[m");
+ }
+ }
+ } else if(i%3 == 0) {
+ printf("\033[0;37mo\033[m");
+ } else {
+ printf("\033[0;37m \033[m");
+ }
+ } else if(i > progresslen - hash) {
printf("#");
- else
+ } else {
printf("-");
+ }
}
- MSG(CL, "] %3d%%\r", percent);
+ printf("] %3d%%\r", percent);
+
FREE(addstr);
FREE(upgstr);
FREE(removestr);