diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-05-15 20:05:51 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-15 20:05:53 +0000 |
commit | 3a6828d50b3b90b92a4ea1deddec4cc4b19e0604 (patch) | |
tree | 4fa47dd244b441174271c953ed799b4deae8b944 | |
parent | 28765c6184afb2c89fba3957172a3ae27c9cc035 (diff) | |
parent | 6da06916211a1292ce83d5fa730cd8f805902b13 (diff) | |
download | native-3a6828d50b3b90b92a4ea1deddec4cc4b19e0604.tar.gz |
Merge "Add lshal --neat option"
-rw-r--r-- | cmds/lshal/ListCommand.cpp | 19 | ||||
-rw-r--r-- | cmds/lshal/ListCommand.h | 5 |
2 files changed, 20 insertions, 4 deletions
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp index 710b6e4c84..38b406ce86 100644 --- a/cmds/lshal/ListCommand.cpp +++ b/cmds/lshal/ListCommand.cpp @@ -344,10 +344,14 @@ void ListCommand::dumpTable() { mImplementationsTable.description = "All available passthrough implementations (all -impl.so files)"; forEachTable([this] (const Table &table) { - mOut << table.description << std::endl; + if (!mNeat) { + mOut << table.description << std::endl; + } mOut << std::left; - printLine("Interface", "Transport", "Arch", "Server", "Server CMD", - "PTR", "Clients", "Clients CMD"); + if (!mNeat) { + printLine("Interface", "Transport", "Arch", "Server", "Server CMD", + "PTR", "Clients", "Clients CMD"); + } for (const auto &entry : table) { printLine(entry.interfaceName, @@ -369,7 +373,9 @@ void ListCommand::dumpTable() { NullableOStream<std::ostream>(nullptr)); } } - mOut << std::endl; + if (!mNeat) { + mOut << std::endl; + } }); } @@ -593,6 +599,7 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { // long options without short alternatives {"sort", required_argument, 0, 's' }, {"init-vintf",optional_argument, 0, 'v' }, + {"neat", no_argument, 0, 'n' }, { 0, 0, 0, 0 } }; @@ -672,6 +679,10 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { } break; } + case 'n': { + mNeat = true; + break; + } case 'h': // falls through default: // see unrecognized options mLshal.usage(command); diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h index 42c965fb28..f367d7f1cf 100644 --- a/cmds/lshal/ListCommand.h +++ b/cmds/lshal/ListCommand.h @@ -85,7 +85,12 @@ private: // If true, calls IBase::debug(...) on each service. bool mEmitDebugInfo = false; + // If true, output in VINTF format. bool mVintf = false; + + // If true, explanatory text are not emitted. + bool mNeat = false; + // If an entry does not exist, need to ask /proc/{pid}/cmdline to get it. // If an entry exist but is an empty string, process might have died. // If an entry exist and not empty, it contains the cached content of /proc/{pid}/cmdline. |