mirror of
https://github.com/systemd/systemd
synced 2024-10-15 12:34:37 +00:00
journalctl: add option to forgo ellipsization
Sometimes it is better to see messages in full, and the existing set of options didn't allow this easily. E.g. now journalctl -f --full will behave like tail -f /var/log/messages of yore. Long option only for now, since small letters are becoming scarce, and this doesn't feel like a capital-letter-option. '-u' would be nice, and the above command would be spelled journalctl -fu
This commit is contained in:
parent
1e1954f533
commit
e3657ecd7f
|
@ -135,6 +135,13 @@
|
||||||
pager.</para></listitem>
|
pager.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--full</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Show all (printable) fields in
|
||||||
|
full.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--all</option></term>
|
<term><option>--all</option></term>
|
||||||
<term><option>-a</option></term>
|
<term><option>-a</option></term>
|
||||||
|
|
|
@ -294,7 +294,8 @@ __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
|
||||||
_journalctl() {
|
_journalctl() {
|
||||||
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
local -A OPTS=(
|
local -A OPTS=(
|
||||||
[STANDALONE]='-a --all -b --this-boot --disk-usage -f --follow --header
|
[STANDALONE]='-a --all --full
|
||||||
|
-b --this-boot --disk-usage -f --follow --header
|
||||||
-h --help -l --local --new-id128 -m --merge --no-pager
|
-h --help -l --local --new-id128 -m --merge --no-pager
|
||||||
--no-tail -q --quiet --setup-keys --this-boot --verify
|
--no-tail -q --quiet --setup-keys --this-boot --verify
|
||||||
--version --list-catalog --update-catalog'
|
--version --list-catalog --update-catalog'
|
||||||
|
|
|
@ -77,6 +77,7 @@ _ctls()
|
||||||
{-n,--lines=}'[Number of journal entries to show]:integer' \
|
{-n,--lines=}'[Number of journal entries to show]:integer' \
|
||||||
'--no-tail[Show all lines, even in follow mode]' \
|
'--no-tail[Show all lines, even in follow mode]' \
|
||||||
{-o,--output=}'[Change journal output mode]:output modes:_outputmodes' \
|
{-o,--output=}'[Change journal output mode]:output modes:_outputmodes' \
|
||||||
|
{--full}'[Show long fields in full]' \
|
||||||
{-a,--all}'[Show all fields, including long and unprintable]' \
|
{-a,--all}'[Show all fields, including long and unprintable]' \
|
||||||
{-q,--quiet}"[Don't show privilege warning]" \
|
{-q,--quiet}"[Don't show privilege warning]" \
|
||||||
'--no-pager[Do not pipe output into a pager]' \
|
'--no-pager[Do not pipe output into a pager]' \
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
|
|
||||||
static OutputMode arg_output = OUTPUT_SHORT;
|
static OutputMode arg_output = OUTPUT_SHORT;
|
||||||
static bool arg_follow = false;
|
static bool arg_follow = false;
|
||||||
|
static bool arg_full = false;
|
||||||
static bool arg_all = false;
|
static bool arg_all = false;
|
||||||
static bool arg_no_pager = false;
|
static bool arg_no_pager = false;
|
||||||
static unsigned arg_lines = 0;
|
static unsigned arg_lines = 0;
|
||||||
|
@ -105,6 +106,7 @@ static int help(void) {
|
||||||
" -o --output=STRING Change journal output mode (short, short-monotonic,\n"
|
" -o --output=STRING Change journal output mode (short, short-monotonic,\n"
|
||||||
" verbose, export, json, json-pretty, json-sse, cat)\n"
|
" verbose, export, json, json-pretty, json-sse, cat)\n"
|
||||||
" -x --catalog Add message explanations where available\n"
|
" -x --catalog Add message explanations where available\n"
|
||||||
|
" --full Do not ellipsize fields\n"
|
||||||
" -a --all Show all fields, including long and unprintable\n"
|
" -a --all Show all fields, including long and unprintable\n"
|
||||||
" -q --quiet Don't show privilege warning\n"
|
" -q --quiet Don't show privilege warning\n"
|
||||||
" --no-pager Do not pipe output into a pager\n"
|
" --no-pager Do not pipe output into a pager\n"
|
||||||
|
@ -140,6 +142,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
ARG_NO_TAIL,
|
ARG_NO_TAIL,
|
||||||
ARG_NEW_ID128,
|
ARG_NEW_ID128,
|
||||||
ARG_HEADER,
|
ARG_HEADER,
|
||||||
|
ARG_FULL,
|
||||||
ARG_SETUP_KEYS,
|
ARG_SETUP_KEYS,
|
||||||
ARG_INTERVAL,
|
ARG_INTERVAL,
|
||||||
ARG_VERIFY,
|
ARG_VERIFY,
|
||||||
|
@ -158,6 +161,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
{ "follow", no_argument, NULL, 'f' },
|
{ "follow", no_argument, NULL, 'f' },
|
||||||
{ "output", required_argument, NULL, 'o' },
|
{ "output", required_argument, NULL, 'o' },
|
||||||
{ "all", no_argument, NULL, 'a' },
|
{ "all", no_argument, NULL, 'a' },
|
||||||
|
{ "full", no_argument, NULL, ARG_FULL },
|
||||||
{ "lines", optional_argument, NULL, 'n' },
|
{ "lines", optional_argument, NULL, 'n' },
|
||||||
{ "no-tail", no_argument, NULL, ARG_NO_TAIL },
|
{ "no-tail", no_argument, NULL, ARG_NO_TAIL },
|
||||||
{ "new-id128", no_argument, NULL, ARG_NEW_ID128 },
|
{ "new-id128", no_argument, NULL, ARG_NEW_ID128 },
|
||||||
|
@ -226,6 +230,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_FULL:
|
||||||
|
arg_full = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
arg_all = true;
|
arg_all = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1065,7 +1073,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
flags =
|
flags =
|
||||||
arg_all * OUTPUT_SHOW_ALL |
|
arg_all * OUTPUT_SHOW_ALL |
|
||||||
(!on_tty() || pager_have()) * OUTPUT_FULL_WIDTH |
|
(arg_full || !on_tty() || pager_have()) * OUTPUT_FULL_WIDTH |
|
||||||
on_tty() * OUTPUT_COLOR |
|
on_tty() * OUTPUT_COLOR |
|
||||||
arg_catalog * OUTPUT_CATALOG;
|
arg_catalog * OUTPUT_CATALOG;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue