Skip to content

Commit dd6ecc4

Browse files
committed
fix
1 parent 8c0b712 commit dd6ecc4

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

example/file/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ cmake_minimum_required (VERSION 3.10)
33
set (t_ example-file)
44
add_executable (${t_} main.cxx)
55
target_link_libraries (${t_} PRIVATE clask-core)
6+
target_include_directories(${t_} PUBLIC .)

example/file/main.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#include <clask/core.hpp>
2+
#include <argparse/argparse.hpp>
3+
4+
int main(int argc, char* argv[]) {
5+
argparse::ArgumentParser program("file", "0.0.0");
6+
program.add_argument("-dir")
7+
.default_value("./public")
8+
.help("public directory")
9+
.metavar("PUBLIC_DIR")
10+
.nargs(1);
11+
program.parse_args(argc, argv);
212

3-
int main() {
413
auto s = clask::server();
514
s.log.default_level = clask::log_level::INFO;
6-
s.static_dir("/", "./public");
15+
s.static_dir("/", program.get<std::string>("-dir"));
716
s.run();
817
}

0 commit comments

Comments
 (0)