mirror of
https://github.com/systemd/systemd
synced 2024-07-21 18:24:38 +00:00
Merge pull request #31597 from keszybz/option-P-for-machinectl-and-timedatectl
Option -P for machinectl and timedatectl
This commit is contained in:
commit
27faf24a48
|
@ -553,6 +553,17 @@
|
|||
<xi:include href="version-info.xml" xpointer="v206"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--value</option></term>
|
||||
|
||||
<listitem><para>When printing properties with <command>show</command>, only print the value,
|
||||
and skip the property name and <literal>=</literal>.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<xi:include href="timedatectl.xml" xpointer="option-P"/>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-a</option></term>
|
||||
<term><option>--all</option></term>
|
||||
|
@ -570,15 +581,6 @@
|
|||
<xi:include href="version-info.xml" xpointer="v206"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--value</option></term>
|
||||
|
||||
<listitem><para>When printing properties with <command>show</command>, only print the value,
|
||||
and skip the property name and <literal>=</literal>.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-l</option></term>
|
||||
<term><option>--full</option></term>
|
||||
|
|
|
@ -135,4 +135,13 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id='option-P'>
|
||||
<term><option>-P</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Equivalent to <option>--value</option> <option>--property=</option>, i.e. shows the value of the
|
||||
property without the property name or <literal>=</literal>. Note that using <option>-P</option> once
|
||||
will also affect all properties listed with <option>-p</option>/<option>--property=</option>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
|
|
@ -1944,11 +1944,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
|
|||
<term><option>-P</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Equivalent to <option>--value</option> <option>--property=</option>, i.e. shows the
|
||||
value of the property without the property name or <literal>=</literal>. Note that using
|
||||
<option>-P</option> once will also affect all properties listed with
|
||||
<option>-p</option>/<option>--property=</option>.</para>
|
||||
|
||||
<xi:include href="standard-options.xml" xpointer="xpointer(//varlistentry[@id='option-P']/listitem/para)" />
|
||||
<xi:include href="version-info.xml" xpointer="v246"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -273,6 +273,15 @@
|
|||
<xi:include href="version-info.xml" xpointer="v239"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id='option-P'>
|
||||
<term><option>-P</option></term>
|
||||
|
||||
<listitem>
|
||||
<xi:include href="standard-options.xml" xpointer="xpointer(//varlistentry[@id='option-P']/listitem/para)" />
|
||||
<xi:include href="version-info.xml" xpointer="v256"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<xi:include href="user-system-options.xml" xpointer="host" />
|
||||
<xi:include href="user-system-options.xml" xpointer="machine" />
|
||||
|
||||
|
|
|
@ -2058,9 +2058,10 @@ static int help(int argc, char *argv[], void *userdata) {
|
|||
" -H --host=[USER@]HOST Operate on remote host\n"
|
||||
" -M --machine=CONTAINER Operate on local container\n"
|
||||
" -p --property=NAME Show only properties by this name\n"
|
||||
" --value When showing properties, only print the value\n"
|
||||
" -P NAME Equivalent to --value --property=NAME\n"
|
||||
" -q --quiet Suppress output\n"
|
||||
" -a --all Show all properties, including empty ones\n"
|
||||
" --value When showing properties, only print the value\n"
|
||||
" -l --full Do not ellipsize output\n"
|
||||
" --kill-whom=WHOM Whom to send signal to\n"
|
||||
" -s --signal=SIGNAL Which signal to send\n"
|
||||
|
@ -2115,8 +2116,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, ARG_VERSION },
|
||||
{ "property", required_argument, NULL, 'p' },
|
||||
{ "all", no_argument, NULL, 'a' },
|
||||
{ "value", no_argument, NULL, ARG_VALUE },
|
||||
{ "all", no_argument, NULL, 'a' },
|
||||
{ "full", no_argument, NULL, 'l' },
|
||||
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
|
||||
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
|
||||
|
@ -2152,7 +2153,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
optind = 0;
|
||||
|
||||
for (;;) {
|
||||
static const char option_string[] = "-hp:als:H:M:qn:o:E:V";
|
||||
static const char option_string[] = "-hp:P:als:H:M:qn:o:E:V";
|
||||
|
||||
c = getopt_long(argc, argv, option_string + reorder, options, NULL);
|
||||
if (c < 0)
|
||||
|
@ -2213,14 +2214,20 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
return version();
|
||||
|
||||
case 'p':
|
||||
case 'P':
|
||||
r = strv_extend(&arg_property, optarg);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
/* If the user asked for a particular
|
||||
* property, show it to them, even if it is
|
||||
* empty. */
|
||||
/* If the user asked for a particular property, show it to them, even if empty. */
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_SHOW_EMPTY, true);
|
||||
|
||||
if (c == 'p')
|
||||
break;
|
||||
_fallthrough_;
|
||||
|
||||
case ARG_VALUE:
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_ONLY_VALUE, true);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
|
@ -2228,10 +2235,6 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
arg_all = true;
|
||||
break;
|
||||
|
||||
case ARG_VALUE:
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_ONLY_VALUE, true);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
arg_full = true;
|
||||
break;
|
||||
|
|
|
@ -888,6 +888,7 @@ static int help(void) {
|
|||
" -p --property=NAME Show only properties by this name\n"
|
||||
" -a --all Show all properties, including empty ones\n"
|
||||
" --value When showing properties, only print the value\n"
|
||||
" -P NAME Equivalent to --value --property=NAME\n"
|
||||
"\nSee the %s for details.\n",
|
||||
program_invocation_short_name,
|
||||
ansi_highlight(),
|
||||
|
@ -902,7 +903,6 @@ static int verb_help(int argc, char **argv, void *userdata) {
|
|||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
enum {
|
||||
ARG_VERSION = 0x100,
|
||||
ARG_NO_PAGER,
|
||||
|
@ -922,8 +922,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
{ "adjust-system-clock", no_argument, NULL, ARG_ADJUST_SYSTEM_CLOCK },
|
||||
{ "monitor", no_argument, NULL, ARG_MONITOR },
|
||||
{ "property", required_argument, NULL, 'p' },
|
||||
{ "all", no_argument, NULL, 'a' },
|
||||
{ "value", no_argument, NULL, ARG_VALUE },
|
||||
{ "all", no_argument, NULL, 'a' },
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -932,8 +932,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
|
||||
while ((c = getopt_long(argc, argv, "hH:M:p:a", options, NULL)) >= 0)
|
||||
|
||||
while ((c = getopt_long(argc, argv, "hH:M:p:P:a", options, NULL)) >= 0)
|
||||
switch (c) {
|
||||
|
||||
case 'h':
|
||||
|
@ -968,26 +967,27 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
arg_monitor = true;
|
||||
break;
|
||||
|
||||
case 'p': {
|
||||
case 'p':
|
||||
case 'P':
|
||||
r = strv_extend(&arg_property, optarg);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
/* If the user asked for a particular
|
||||
* property, show it to them, even if it is
|
||||
* empty. */
|
||||
/* If the user asked for a particular property, show it to them, even if empty. */
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_SHOW_EMPTY, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'a':
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_SHOW_EMPTY, true);
|
||||
break;
|
||||
if (c == 'p')
|
||||
break;
|
||||
_fallthrough_;
|
||||
|
||||
case ARG_VALUE:
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_ONLY_VALUE, true);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
SET_FLAG(arg_print_flags, BUS_PRINT_PROPERTY_SHOW_EMPTY, true);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue