[pacman-dev] [PATCHv2 00/10] Add color to script output

William Giokas 1007380 at gmail.com
Sun Mar 3 13:48:15 EST 2013


This is a version two of the original pacman script color patches that I
sent in. This includes three new patches, and a fix to the first patch so
that I don't break `pkgver()` functions in makepkg.

---

Originally, output_format.sh sent some messages to sdtout and some to
stderr, but this patch set sends all messages formatted by output_format to
stderr making separation of script output and child processes easy to
separate. The QUIET variable can be used to get the equivalent of only
printing stderr. I'm going to start working on using a flag to determine
where the messages from output_format go, as per Dave's suggestion.

The script patches try to implement the same color styles as makepkg, mostly
by consolidating the message formats into a single library file and
including that in all of the files that require it. 

In the pacdiff patch, I simply changed the colors, making it use a similar
format as the other files. output_format also got a new function, `ask`,
that looks similar to `msg2` but without a new line at the end for use with
`read`. I don't know if the look is okay, I was thinking about making it
look like pacman's questions, with a pair of blue colons instead of an
arrow. If anyone has input on this, please speak up.

The rest of the patches just implement a similar look as makepkg, using
`==>` and `->` to precede messages, and colored errors and warnings.

The use of a unified output_format file also affords makepkg the --quiet
option, setting the `QUIET` variable to suppress messages that are not
warnings, errors or output from a command in a PKGBUILD.

---

William Giokas (10):
  script: Add color to library/output_format.sh
  makepkg: use output_format, add --quiet option
  script: add color to pacman-db-upgrade
  scripts: add color to pacman-key
  scripts: add color to pacman-optimize
  scripts: add color to pkgdelta
  scripts: add color to repo-add
  contrib: add colored output to bacman
  contrib: add color to paccache
  contrib: make pacdiff colors same as scripts

 contrib/bacman.sh.in             | 62 ++++++++++++++++++++++------------------
 contrib/paccache.sh.in           | 19 ++++++------
 contrib/pacdiff.sh.in            | 35 ++++++-----------------
 doc/makepkg.8.txt                |  4 +++
 doc/pacman-key.8.txt             |  3 ++
 doc/repo-add.8.txt               |  3 ++
 scripts/library/README           |  6 +++-
 scripts/library/output_format.sh | 23 +++++++++++----
 scripts/library/term_colors.sh   | 21 ++++++++++++++
 scripts/makepkg.sh.in            | 35 +++++------------------
 scripts/pacman-db-upgrade.sh.in  | 11 ++++++-
 scripts/pacman-key.sh.in         |  8 ++++--
 scripts/pacman-optimize.sh.in    | 11 ++++++-
 scripts/pkgdelta.sh.in           |  6 ++++
 scripts/repo-add.sh.in           |  5 ++++
 15 files changed, 149 insertions(+), 103 deletions(-)
 create mode 100644 scripts/library/term_colors.sh


Thank you,
-- 
William Giokas
1.8.2.rc1.24.g06d67b8



More information about the pacman-dev mailing list