From f3e23c54170e152fa5b829cbe40253dd6cb74bd8 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 19 Jan 2016 14:56:48 +0000 Subject: [PATCH] [thin_ls] add --no-headers --- thin-provisioning/thin_ls.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/thin_ls.cc b/thin-provisioning/thin_ls.cc index 4ceb3d0..adc58d1 100644 --- a/thin-provisioning/thin_ls.cc +++ b/thin-provisioning/thin_ls.cc @@ -212,7 +212,8 @@ namespace { struct flags { flags() - : use_metadata_snap(false) { + : use_metadata_snap(false), + headers(true) { fields.push_back(DEV_ID); fields.push_back(MAPPED); @@ -221,6 +222,7 @@ namespace { } bool use_metadata_snap; + bool headers; vector fields; }; @@ -363,7 +365,8 @@ namespace { for (it = map.begin(); it != map.end(); ++it) pass1(md, mappings, it->first); - print_headers(grid, flags.fields); + if (flags.headers) + print_headers(grid, flags.fields); for (it = map.begin(); it != map.end(); ++it) { vector::const_iterator f; @@ -478,6 +481,7 @@ thin_ls_cmd::usage(std::ostream &out) const << "Options:\n" << " {-h|--help}\n" << " {-m|--metadata-snap}\n" + << " {--no-headers}\n" << " {-o|--format }\n" << " {-V|--version}\n\n" << "where is a comma separated list from:\n"; @@ -511,6 +515,7 @@ thin_ls_cmd::run(int argc, char **argv) { "metadata-snap", no_argument, NULL, 'm' }, { "version", no_argument, NULL, 'V'}, { "format", required_argument, NULL, 'o' }, + { "no-headers", no_argument, NULL, 1 }, { NULL, no_argument, NULL, 0 } }; @@ -532,6 +537,10 @@ thin_ls_cmd::run(int argc, char **argv) cout << THIN_PROVISIONING_TOOLS_VERSION << endl; return 0; + case 1: + flags.headers = false; + break; + default: usage(cerr); return 1;