refactor common code in query_search/sync_search

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
remove :: prefix from all message

This will substantially simplify the logic to add colours to messages.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
split "Packages (%zd):" message

Basically all translation messages that need colouring but _also_ happen
to be format strings need to be split up.

This makes it easy to conditionally embed colour codes into the output
at runtime.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
remove format from statistic messages

Remove the format component of the "Total Download Size" and related
messages. The heading will be colourized, the size won't.

However since the length of these messages can vary by language, we need
a pretty printer to format them nicely.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
standarise format functions

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
add a config settings and flag for colors

Colours can be enabled in two ways:

- Add Color to pacman.conf. This enables colours automatically.
- Use --color=WHEN where WHEN is none/auto/always.

WHEN as 'never' disables colours (overrides config file), as 'auto'
enables colours when stdout is a tty, and 'always' enables colours no
matter what.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
introduce colstr for colourizing

colstr_t colstr will hold the colourizing agents.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colourize colon_printf

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colourize warnings and errors

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colourize table output

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
have question properly reset itself

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colorize the output if -Qi/Si

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colourize -Qs/-Ss

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colourize -Sl/-Ql

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
colourize -Q

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
update documentation and config files

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
script: Add color to library/output_format.sh

Use the same colors as makepkg when printing messages using the
functions in output_format.sh.

Signed-off-by: William Giokas <1007380@gmail.com>
makepkg: use output_format, add --quiet option

output_format.sh is now much the same as the original message
subroutines, so just use m4_include to pull that in. This also adds a
`(( QUIET )) && return` to the output format section, allowing for a
--quiet switch to suppress some output.

Signed-off-by: William Giokas <1007380@gmail.com>
script: add color to pacman-db-upgrade

Use color by default, -m/--no-color turns off colors.

Signed-off-by: William Giokas <1007380@gmail.com>
scripts: add color to pacman-key

Use --no-color to suppress colored output

Signed-off-by: William Giokas <1007380@gmail.com>