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>
standardize format functions

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

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 and question

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>
colourize the output of -Qi/Si

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

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>
remove the duplicate strnlen and strndup

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