diff options
author | Alexis211 <alexis211@gmail.com> | 2009-12-17 11:18:19 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-12-17 11:18:19 +0100 |
commit | 4f9078c0f06e0cf0cb7bb164fc72fb9918c68e6a (patch) | |
tree | 34815307b54bf8639ba89f2efddf03e96ee4c0d0 /Source/Applications | |
parent | 3d5aca66b9712758aecb2e80bc5b2fb3df6256a4 (diff) | |
download | Melon-4f9078c0f06e0cf0cb7bb164fc72fb9918c68e6a.tar.gz Melon-4f9078c0f06e0cf0cb7bb164fc72fb9918c68e6a.zip |
Added some option handling featurs to the default ShellApp class
Diffstat (limited to 'Source/Applications')
-rw-r--r-- | Source/Applications/Demos/GOL.cpp | 2 | ||||
-rw-r--r-- | Source/Applications/Demos/cxxdemo.cpp | 2 | ||||
-rw-r--r-- | Source/Applications/PaperWork/PaperWork.cpp | 20 | ||||
-rw-r--r-- | Source/Applications/Shell/Shell.class.cpp | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/Source/Applications/Demos/GOL.cpp b/Source/Applications/Demos/GOL.cpp index cd6e719..675c159 100644 --- a/Source/Applications/Demos/GOL.cpp +++ b/Source/Applications/Demos/GOL.cpp @@ -6,7 +6,7 @@ class GOL : public ShellApp { public: - GOL() : ShellApp() {} + GOL() : ShellApp("GOL.app", "Melon's Game of Life simulator \\o/") {} int run(); }; diff --git a/Source/Applications/Demos/cxxdemo.cpp b/Source/Applications/Demos/cxxdemo.cpp index 372e69f..36cfd27 100644 --- a/Source/Applications/Demos/cxxdemo.cpp +++ b/Source/Applications/Demos/cxxdemo.cpp @@ -6,7 +6,7 @@ class CPPDemo : public ShellApp { public: - CPPDemo() : ShellApp() {} + CPPDemo() : ShellApp("CPPDemo.app", "A demo application using the C++ Melon framework") {} int run(); }; diff --git a/Source/Applications/PaperWork/PaperWork.cpp b/Source/Applications/PaperWork/PaperWork.cpp index 0d6a821..4f9cb0e 100644 --- a/Source/Applications/PaperWork/PaperWork.cpp +++ b/Source/Applications/PaperWork/PaperWork.cpp @@ -4,7 +4,11 @@ class PaperWork : public ShellApp { public: - PaperWork() : ShellApp() {} + PaperWork() : ShellApp("PaperWork.app", "Melon's init/login manager") { + addFlag("s", "shell", "Define the default shell to launch", FT_STR, DEFAULT_SHELL); + addFlag("l", "login", "Act as a login manager"); + addFlag("i", "init", "Act as a init manager", FT_BOOL, "on"); + } int run(); }; @@ -12,13 +16,7 @@ APP(PaperWork); int PaperWork::run() { String act = "init"; - if (args.size() == 2) { - if (args[1] == "login") { - act = "login"; - } else if (args[1] == "init") { - act = "init"; - } - } + if (bFlag("login")) act = "login"; if (act == "init") { while (1) { @@ -26,7 +24,7 @@ int PaperWork::run() { if (p.valid()) { p.setInVT(invt); p.setOutVT(outvt); - p.pushArg("login"); + p.pushArg("--login"); p.start(); p.wait(); } else { @@ -45,9 +43,9 @@ int PaperWork::run() { outvt << "Authentication failed.\n\n"; continue; } - outvt << "What shell to run [" << DEFAULT_SHELL << "]? "; + outvt << "What shell to run [" << sFlag("shell") << "]? "; String sh = invt.readLine(); - if (sh == "") sh = DEFAULT_SHELL; + if (sh == "") sh = sFlag("shell"); Process p = Process::run(sh); if (p.valid()) { p.setInVT(invt); diff --git a/Source/Applications/Shell/Shell.class.cpp b/Source/Applications/Shell/Shell.class.cpp index 42743e7..4e0f18b 100644 --- a/Source/Applications/Shell/Shell.class.cpp +++ b/Source/Applications/Shell/Shell.class.cpp @@ -4,7 +4,7 @@ APP(Shell); -Shell::Shell() : ShellApp(), cwd(FS::cwdNode()) { +Shell::Shell() : ShellApp("Shell.app", "The Melon command line interpreter"), cwd(FS::cwdNode()) { } int Shell::run() { |