Skip to content

Commit d8009ee

Browse files
committed
Now you can get to know the version and exit properly.
1 parent 1a01b2c commit d8009ee

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# NShell Changelog
22

3+
## Build 3
4+
5+
- Okay, now version and exit do something.
6+
37
## Build 2
48

59
- Now you can type something in, but then it just says goodbye.

main.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
#include <iostream>
22
#include <limits>
33

4-
int buildNr = 2;
4+
int buildNr = 3;
55

66
int main()
77
{
88
std::cout << "NShell" << '\n';
99
std::cout << "Build: " << buildNr << '\n';
10-
std::cout << "Early prototype! Don't expect it to be useful." << '\n';
10+
std::cout << "Early prototype! Don't expect it to be useful.\n" << '\n';
1111

12-
std::cout << "NShell > ";
13-
std::string command_to_run;
14-
std::cin >> command_to_run;
12+
while (true) {
13+
std::cout << "NShell > ";
14+
std::string command_to_run;
15+
std::cin >> command_to_run;
1516

16-
std::cout << "You would have run " << command_to_run << ". Thanks for testing. Goodbye.";
17+
if (command_to_run == "version") {
18+
std::cout << "NShell Build " << buildNr << '\n';
19+
}
20+
21+
else if (command_to_run == "exit") {
22+
std::cout << "Goodbye. Please press Enter to exit the application." << '\n';
23+
break;
24+
}
25+
26+
else {
27+
std::cout << "Unknown command!\n";
28+
}
29+
}
1730

1831
std::cin.clear();
1932
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

0 commit comments

Comments
 (0)