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/PaperWork | |
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/PaperWork')
-rw-r--r-- | Source/Applications/PaperWork/PaperWork.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
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); |