-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (28 loc) · 914 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (28 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "projectcore.h"
#include <cstddef>
#include <iostream>
#include <iterator>
#include <span>
#include <string_view>
namespace {
void writeHelp()
{
std::cout << "Usage: frame_cli [--help] [project-name]\n";
std::cout << "Normalizes an example project name for deterministic output.\n";
}
} // namespace
int main(int argc, char *argv[])
{
const std::span<char *> arguments(argv, static_cast<std::size_t>(argc));
const bool hasSecondArgument = arguments.size() > 1U;
const std::string_view secondArgument =
hasSecondArgument ? std::string_view(*std::next(arguments.begin())) : std::string_view{};
if (secondArgument == "--help") {
writeHelp();
return 0;
}
const std::string_view input =
hasSecondArgument ? secondArgument : std::string_view("Example Project");
std::cout << frame::normalizedProjectName(input) << '\n';
return 0;
}