MCPcopy Create free account
hub / github.com/apache/mesos / usage

Function usage

src/cli/mesos.cpp:38–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37
38void usage(const char* argv0)
39{
40 // Get a list of available commands.
41 const Option<string> PATH = os::getenv("PATH");
42
43 list<string> commands;
44
45 if (PATH.isSome()) {
46 foreach (const string& path, strings::split(PATH.get(), ":")) {
47 Try<list<string>> matches = fs::list(path::join(path, "mesos-*"));
48 if (matches.isSome()) {
49 foreach (const string& match, matches.get()) {
50 Try<bool> access = os::access(match, X_OK);
51 if (access.isSome() && access.get()) {
52 string basename = Path(match).basename();
53 if (basename != "mesos-slave") {
54 commands.push_back(basename.substr(6));
55 }
56 }
57 }
58 }
59 }
60 }
61
62 cerr
63 << "Usage: " << Path(argv0).basename() << " <command> [OPTIONS]"
64 << endl
65 << endl
66 << "Available commands:" << endl
67 << " help" << endl;
68
69 foreach (const string& command, commands) {
70 cerr << " " << command << endl;
71 }
72}
73
74
75int main(int argc, char** argv)

Callers 1

mainFunction · 0.70

Calls 4

PathClass · 0.85
getenvFunction · 0.50
isSomeMethod · 0.45
basenameMethod · 0.45

Tested by

no test coverage detected