mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmconfig: add --withspaces option
We shouldn't be adding spaces by default in output as that may be be used already in scripts and especially for the eval in shell scripts where spaces are not allowed between key and value! Add --withspaces option to lvmconfig for pretty output with more space in for readability.
This commit is contained in:
parent
a25d92c88b
commit
a4724350e4
@ -1,5 +1,6 @@
|
||||
Version 2.02.123 -
|
||||
=================================
|
||||
Add --withspaces to lvmconfig to add spaces in output for better readability.
|
||||
|
||||
Version 2.02.122 - 20th June 2015
|
||||
=================================
|
||||
|
@ -1756,7 +1756,8 @@ static struct dm_config_node *_add_def_node(struct dm_config_tree *cft,
|
||||
log_error("Failed to create default config setting node value.");
|
||||
return NULL;
|
||||
}
|
||||
format_flags |= DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES;
|
||||
if (spec->withspaces)
|
||||
format_flags |= DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES;
|
||||
}
|
||||
|
||||
cn->id = def->id;
|
||||
@ -1799,8 +1800,9 @@ static struct dm_config_node *_add_def_node(struct dm_config_tree *cft,
|
||||
}
|
||||
dm_config_value_set_format_flags(cn->v, format_flags);
|
||||
} else {
|
||||
format_flags |= (DM_CONFIG_VALUE_FMT_COMMON_ARRAY |
|
||||
DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES);
|
||||
if (spec->withspaces)
|
||||
format_flags |= DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES;
|
||||
format_flags |= DM_CONFIG_VALUE_FMT_COMMON_ARRAY;
|
||||
cn->v = _get_def_array_values(cft, def, format_flags);
|
||||
}
|
||||
|
||||
|
@ -163,6 +163,7 @@ struct config_def_tree_spec {
|
||||
unsigned withsummary:1; /* include first line of comments - a summary */
|
||||
unsigned withcomments:1; /* include all comment lines */
|
||||
unsigned withversions:1; /* include versions */
|
||||
unsigned withspaces:1; /* add more spaces in output for better readability */
|
||||
unsigned unconfigured:1; /* use unconfigured path strings */
|
||||
uint8_t *check_status; /* status of last tree check (currently needed for CFG_DEF_TREE_MISSING only) */
|
||||
};
|
||||
|
@ -27,6 +27,7 @@ lvmconfig, lvm dumpconfig, lvm config \(em Display LVM configuration
|
||||
.RB [ \-\-validate ]
|
||||
.RB [ \-\-withsummary ]
|
||||
.RB [ \-\-withcomments ]
|
||||
.RB [ \-\-withspaces ]
|
||||
.RB [ \-\-withversions ]
|
||||
.RB [ ConfigurationNode... ]
|
||||
|
||||
@ -185,6 +186,10 @@ Display a one line comment for each configuration node.
|
||||
Display a full comment for each configuration node. For deprecated
|
||||
settings, also display comments about deprecation in addition.
|
||||
|
||||
.TP
|
||||
.B \-\-withspaces
|
||||
Where appropriate, add more spaces in output for better readability.
|
||||
|
||||
.TP
|
||||
.B \-\-withversions
|
||||
Also display a comment containing the version of introduction for
|
||||
|
@ -124,6 +124,7 @@ arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
|
||||
arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0)
|
||||
arg(withsummary_ARG, '\0', "withsummary", NULL, 0)
|
||||
arg(withcomments_ARG, '\0', "withcomments", NULL, 0)
|
||||
arg(withspaces_ARG, '\0', "withspaces", NULL, 0)
|
||||
arg(withversions_ARG, '\0', "withversions", NULL, 0)
|
||||
arg(writebehind_ARG, '\0', "writebehind", int_arg, 0)
|
||||
arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE)
|
||||
|
@ -104,13 +104,14 @@ xx(dumpconfig,
|
||||
"\t[--validate]\n"
|
||||
"\t[--withsummary]\n"
|
||||
"\t[--withcomments]\n"
|
||||
"\t[--withspaces]\n"
|
||||
"\t[--unconfigured]\n"
|
||||
"\t[--withversions]\n"
|
||||
"\t[ConfigurationNode...]\n",
|
||||
atversion_ARG, configtype_ARG, file_ARG, ignoreadvanced_ARG,
|
||||
ignoreunsupported_ARG, ignorelocal_ARG, list_ARG, mergedconfig_ARG, metadataprofile_ARG,
|
||||
showdeprecated_ARG, showunsupported_ARG, validate_ARG, withsummary_ARG, withcomments_ARG,
|
||||
unconfigured_ARG, withversions_ARG)
|
||||
withspaces_ARG, unconfigured_ARG, withversions_ARG)
|
||||
|
||||
xx(formats,
|
||||
"List available metadata formats",
|
||||
|
@ -277,6 +277,9 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (arg_count(cmd, withversions_ARG))
|
||||
tree_spec.withversions = 1;
|
||||
|
||||
if (arg_count(cmd, withspaces_ARG))
|
||||
tree_spec.withspaces = 1;
|
||||
|
||||
if (cft_check_handle)
|
||||
tree_spec.check_status = cft_check_handle->status;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user