diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-07-22 22:37:40 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-07-24 21:37:58 +0300 |
commit | 72945d9c8eee18aed1550c3f42dc41e6a8a0f029 (patch) | |
tree | 9fdfe1c3bf48d0e303dc435c40116dacf48286b3 /libbuild2/test/script/builtin.cli | |
parent | 83bb02cada0b894d9134cc5489999e0f0fe8bd7c (diff) |
Use CLI-generated classes to parse testscript builtin options
Diffstat (limited to 'libbuild2/test/script/builtin.cli')
-rw-r--r-- | libbuild2/test/script/builtin.cli | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/libbuild2/test/script/builtin.cli b/libbuild2/test/script/builtin.cli new file mode 100644 index 0000000..8b8de73 --- /dev/null +++ b/libbuild2/test/script/builtin.cli @@ -0,0 +1,103 @@ +// file : libbuild2/test/script/builtin.cli +// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +include <libbuild2/types.hxx>; + +// Note that options in this file are undocumented because we generate neither +// the usage printing code nor man pages. Instead, they are documented in the +// Testscript Language Manual's builtin descriptions. +// +// Also note that the string type is used for the path options because their +// parsing depends on the testscript scope working directory (see parse_path() +// for details) and passing this information to the CLI custom parser would +// not be easy. +// +namespace build2 +{ + namespace test + { + namespace script + { + // Common option base classes. + // + + class cleanup_options = 0 + { + bool --no-cleanup; + }; + + // Builtin options. + // + + class cat_options + { + // No options so far. + // + }; + + class cp_options: cleanup_options + { + bool --recursive|-R|-r; + bool --preserve|-p; + }; + + class ln_options: cleanup_options + { + bool --symbolic|-s; + }; + + class mkdir_options: cleanup_options + { + bool --parents|-p; + }; + + class mv_options: cleanup_options + { + bool --force|-f; + }; + + class rm_options + { + bool --recursive|-r; + bool --force|-f; + }; + + class rmdir_options + { + bool --force|-f; + }; + + class sed_options + { + bool --quiet|-n; + bool --in-place|-i; + strings --expression|-e; + }; + + class set_options + { + bool --exact|-e; + bool --newline|-n; + bool --whitespace|-w; + }; + + class sleep_options + { + // No options so far. + // + }; + + class test_options + { + bool --file|-f; + bool --directory|-d; + }; + + class touch_options: cleanup_options + { + string --after; // Path (see above). + }; + } + } +} |