diff --git a/docs/man/antler-proj.1 b/docs/man/antler-proj.1 index 183f902c..c495e637 100644 --- a/docs/man/antler-proj.1 +++ b/docs/man/antler-proj.1 @@ -1,28 +1,28 @@ -.\" Automatically generated by Pandoc 2.5 +.\" Automatically generated by Pandoc 2.9.2.1 .\" -.TH "antler\-proj" "1" "March 09, 2023" "antler\-proj 1.0.0" "User Manual" +.TH "antler-proj" "1" "March 09, 2023" "antler-proj 1.0.0" "User Manual" .hy .SH NAME .PP -antler\-proj \- Antler Project Management System +antler-proj - Antler Project Management System .SH SYNOPSIS .PP -\f[C]antler\-proj []\f[R] +\f[C]antler-proj []\f[R] .SH DESCRIPTION .PP \f[B]Antler Project Management System\f[R] is a set of libraries and tools to help users successfully develop smart contracts. .SH COMMANDS .PP -This is a general help text which prints when antler\-proj runs without -a command or with key \[en]help. +This is a general help text which prints when antler-proj runs without a +command or with key \[em]help. .PP -\f[B]Example: antler\-proj \[en]help\f[R] +\f[B]Example: \f[CB]antler-proj --help\f[B]\f[R] .PP Each command has its own help which prints when the command runs with -key \[en]help. +key \[em]help. .PP -\f[B]Example: antler\-proj init \[en]help\f[R] +\f[B]Example: \f[CB]antler-proj init --help\f[B]\f[R] .PP Below is described a full list of all possible commands and their possible arguments @@ -34,62 +34,62 @@ initializes it. .nf \f[C] Command arguments: - Path to the root of the project. Here a \[ga]project.yaml\[ga] file will be created + Path to the root of the project. Here a \[ga]project.yaml\[ga] file will be created Name of the project [version] Version of the project. Default version is 0.0.1 - \-h,\-\-help Print this help message and exit - \-p Path to the root of the project. - \-n The name of the project. - \-v The version to store in the project file. + -h,--help Print this help message and exit + -p Path to the root of the project. + -n The name of the project. + -v The version to store in the project file. \f[R] .fi .PP -\f[B]Example: antler\-proj init ./project hello_world 0.1\f[R] +\f[B]Example: \f[CB]antler-proj init ./project hello_world 0.1\f[B]\f[R] .PP \f[B]add\f[R] command adds an app, dependency, library or test to your project. .IP .nf \f[C] -Command arguments: - \-h,\-\-help Print this help message and exit - \-p This must be the path to the \[ga]project.yml\[ga] or the path containing it. +Command arguments: + -h,--help Print this help message and exit + -p This must be the path to the \[ga]project.yml\[ga] or the path containing it. [path] Path to the root of the project. - Type of an entity to work with + Type of an entity to work with \f[R] .fi .PP -\f[B]Example: antler\-proj add ./project app\f[R] +\f[B]Example: \f[CB]antler-proj add ./project app\f[B]\f[R] .PP \f[B]update\f[R] command updates an app, dependency, library or test to your project. .IP .nf \f[C] -Command arguments: - \-h,\-\-help Print this help message and exit - \-p This must be the path to the \[ga]project.yml\[ga] or the path containing it. +Command arguments: + -h,--help Print this help message and exit + -p This must be the path to the \[ga]project.yml\[ga] or the path containing it. [path] Path to the root of the project. - Type of an entity to work with + Type of an entity to work with \f[R] .fi .PP -\f[B]Example: antler\-proj update ./project app\f[R] +\f[B]Example: \f[CB]antler-proj update ./project app\f[B]\f[R] .PP \f[B]remove\f[R] command removes an app, dependency, library or test from your project. .IP .nf \f[C] -Command arguments: - \-h,\-\-help Print this help message and exit - \-p This must be the path to the \[ga]project.yml\[ga] or the path containing it. +Command arguments: + -h,--help Print this help message and exit + -p This must be the path to the \[ga]project.yml\[ga] or the path containing it. [path] Path to the root of the project. - Type of an entity to work with + Type of an entity to work with \f[R] .fi .PP -\f[B]Example: antler\-proj remove ./project app\f[R] +\f[B]Example: \f[CB]antler-proj remove ./project app\f[B]\f[R] .PP \f[B]populate\f[R] command loads existing information about the project starting from the root project.yaml file as described in the chapter @@ -97,7 +97,7 @@ starting from the root project.yaml file as described in the chapter .IP .nf \f[C] -Without additional keys it passes through a subtree of each application and checks all non\-local dependencies for updates. +Without additional keys it passes through a subtree of each application and checks all non-local dependencies for updates. Downloads all the updates in a way depending on where it is located. \f[R] .fi @@ -105,13 +105,13 @@ Downloads all the updates in a way depending on where it is located. .nf \f[C] Command arguments: - \-h,\-\-help Print this help message and exit - \-p This must be the path to the \[ga]project.yml\[ga] or the path containing it. - [path] Path to the root of the project. + -h,--help Print this help message and exit + -p This must be the path to the \[ga]project.yml\[ga] or the path containing it. + [path] Path to the root of the project. \f[R] .fi .PP -\f[B]Example: antler\-proj populate ./project\f[R] +\f[B]Example: \f[CB]antler-proj populate ./project\f[B]\f[R] .PP \f[B]validate\f[R] command performs a check of the project to ensure that all data that describes the project is correct. @@ -129,13 +129,13 @@ exist and if it is possible to download all remote dependencies. .nf \f[C] Command arguments: - \-h,\-\-help Print this help message and exit - \-p Path to the root of the project. - \-V,\-\-verbose Verbose output. + -h,--help Print this help message and exit + -p Path to the root of the project. + -V,--verbose Verbose output. \f[R] .fi .PP -\f[B]Example: antler\-proj validate ./project\f[R] +\f[B]Example: \f[CB]antler-proj validate ./project\f[B]\f[R] .PP \f[B]build\f[R] command builds all applications described in the project.yaml, their dependencies and tests. @@ -143,17 +143,36 @@ project.yaml, their dependencies and tests. .nf \f[C] Command arguments: - \-h,\-\-help Print this help message and exit - \-p This must be the path to the \[ga]project.yml\[ga] or the path containing it. - [path] Path to the root of the project. + -h,--help Print this help message and exit + -p This must be the path to the \[ga]project.yml\[ga] or the path containing it. + [path] Path to the root of the project. \f[R] .fi .PP -\f[B]Example: antler\-proj build ./project\f[R] +\f[B]Example: \f[CB]antler-proj build ./project\f[B]\f[R] .PP -\f[B]version\f[R] Returns the version of antler\-proj application -\f[B]Example: antler\-proj version\f[R] +\f[B]\f[CB]--version\f[B]\f[R] Returns the version of antler-proj +application \f[B]Example: \f[CB]antler-proj --version\f[B]\f[R] .SH EXAMPLES +.IP +.nf +\f[C] + antler-proj add app MyApp C++ \[rs]\[rs]-O2 + antler-proj add app -n MyApp -l C++ \[dq]\[rs]-O2 -WError\[dq] \[rs]\[rs]-s + antler-proj add lib MyLib C++ \[rs]\[rs]-O2 \[dq]\[rs]-s\[dq] + antler-proj add dep MyApp MyDep + antler-proj build -j3 + antler-proj init MyProjectName 1.0.0 + antler-proj populate ./path-to-project + antler-proj remove app MyApp + antler-proj remove lib MyLib + antler-proj remove dep MyDep MyApp + antler-proj update app MyApp C++ \[rs]\[rs]-O2 + antler-proj update lib MyLib C++ \[rs]\[rs]-O2 \[dq]\[rs]-s\[dq] + antler-proj update dep MyDep -l AntelopeIO/my_dep + antler-proj validate +\f[R] +.fi .SH AUTHORS .SH BUGS .PP diff --git a/docs/man/antler-proj.1.md b/docs/man/antler-proj.1.md index a04bad03..72a47e0c 100644 --- a/docs/man/antler-proj.1.md +++ b/docs/man/antler-proj.1.md @@ -18,21 +18,21 @@ antler-proj - Antler Project Management System # COMMANDS -This is a general help text which prints when antler-proj runs without a command or with key --help. +This is a general help text which prints when antler-proj runs without a command or with key ---help. -**Example: antler-proj --help** +**Example: `antler-proj --help`** -Each command has its own help which prints when the command runs with key --help. +Each command has its own help which prints when the command runs with key ---help. -**Example: antler-proj init --help** +**Example: `antler-proj init --help`** -Below is described a full list of all possible commands and their possible arguments +Below is described a full list of all possible commands and their possible arguments **init** command creates a new project. Creating the directory tree, a `project.yaml` file and initializes it. -``` +``` Command arguments: - Path to the root of the project. Here a `project.yaml` file will be created + Path to the root of the project. Here a `project.yaml` file will be created Name of the project [version] Version of the project. Default version is 0.0.1 -h,--help Print this help message and exit @@ -40,57 +40,57 @@ Command arguments: -n The name of the project. -v The version to store in the project file. ``` -**Example: antler-proj init ./project hello_world 0.1** +**Example: `antler-proj init ./project hello_world 0.1`** **add** command adds an app, dependency, library or test to your project. ``` -Command arguments: +Command arguments: -h,--help Print this help message and exit -p This must be the path to the `project.yml` or the path containing it. [path] Path to the root of the project. - Type of an entity to work with + Type of an entity to work with ``` -**Example: antler-proj add ./project app** +**Example: `antler-proj add ./project app`** **update** command updates an app, dependency, library or test to your project. ``` -Command arguments: +Command arguments: -h,--help Print this help message and exit -p This must be the path to the `project.yml` or the path containing it. [path] Path to the root of the project. - Type of an entity to work with + Type of an entity to work with ``` -**Example: antler-proj update ./project app** +**Example: `antler-proj update ./project app`** **remove** command removes an app, dependency, library or test from your project. ``` -Command arguments: +Command arguments: -h,--help Print this help message and exit -p This must be the path to the `project.yml` or the path containing it. [path] Path to the root of the project. - Type of an entity to work with + Type of an entity to work with ``` -**Example: antler-proj remove ./project app** +**Example: `antler-proj remove ./project app`** **populate** command loads existing information about the project starting from the root project.yaml file as described in the chapter `"Loading of a project"` in the User's guide. - Without additional keys it passes through a subtree of each application and checks all non-local dependencies for updates. + Without additional keys it passes through a subtree of each application and checks all non-local dependencies for updates. Downloads all the updates in a way depending on where it is located. ``` Command arguments: -h,--help Print this help message and exit -p This must be the path to the `project.yml` or the path containing it. - [path] Path to the root of the project. + [path] Path to the root of the project. ``` -**Example: antler-proj populate ./project** +**Example: `antler-proj populate ./project`** **validate** command performs a check of the project to ensure that all data that describes the project is correct. @@ -106,7 +106,7 @@ Command arguments: -p Path to the root of the project. -V,--verbose Verbose output. ``` -**Example: antler-proj validate ./project** +**Example: `antler-proj validate ./project`** **build** command builds all applications described in the project.yaml, their dependencies and tests. @@ -114,16 +114,33 @@ Command arguments: Command arguments: -h,--help Print this help message and exit -p This must be the path to the `project.yml` or the path containing it. - [path] Path to the root of the project. + [path] Path to the root of the project. ``` -**Example: antler-proj build ./project** +**Example: `antler-proj build ./project`** -**version** Returns the version of antler-proj application -**Example: antler-proj version** +**`--version`** Returns the version of antler-proj application +**Example: `antler-proj --version`** # EXAMPLES +``` + antler-proj add app MyApp C++ \\-O2 + antler-proj add app -n MyApp -l C++ "\-O2 -WError" \\-s + antler-proj add lib MyLib C++ \\-O2 "\-s" + antler-proj add dep MyApp MyDep + antler-proj build -j3 + antler-proj init MyProjectName 1.0.0 + antler-proj populate ./path-to-project + antler-proj remove app MyApp + antler-proj remove lib MyLib + antler-proj remove dep MyDep MyApp + antler-proj update app MyApp C++ \\-O2 + antler-proj update lib MyLib C++ \\-O2 "\-s" + antler-proj update dep MyDep -l AntelopeIO/my_dep + antler-proj validate +``` + # AUTHORS # BUGS @@ -131,5 +148,3 @@ Please submit bug reports online at: - - diff --git a/include/antler/project/project.hpp b/include/antler/project/project.hpp index daede16e..04af7abb 100644 --- a/include/antler/project/project.hpp +++ b/include/antler/project/project.hpp @@ -127,15 +127,16 @@ class project { /// Return the first object with the matching name where search order is apps, libs, tests. - /// @TODO replace this with a std::vector/antler::project::object::list_t to return all the objects - /// with matching names. /// @param name The name to search for in the object lists. /// @param type If type is other than any, the search is limited to that single type. /// @return vector with copies of the objects. template [[nodiscard]] auto& object(const std::string& name) { + const auto& get = [](auto nm, auto& c) -> auto& { auto itr = c.find(nm); + if(itr == c.end()) + throw std::out_of_range(nm + " not found"); return itr->second; }; diff --git a/tools/add_to.hpp b/tools/add_to.hpp index 2e7a28af..c544532f 100644 --- a/tools/add_to.hpp +++ b/tools/add_to.hpp @@ -142,9 +142,15 @@ namespace antler { add_to_project(CLI::App& app) { path = system::fs::current_path().string(); subcommand = app.add_subcommand("add", "Add an app, dependency, library or test to your project."); - subcommand->add_option("-p, path", path, "This is the root path to create the project in.")->default_val("."); + subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); app_subcommand = subcommand->add_subcommand("app", "Add a new app to your project."); + app_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( add app MyApp C++ \\-O2)" + + "\n\t" + app.get_name() +R"( add app -p ./path-to-project/ -n MyApp -l C++ --comp -O2)" + + "\n\t" + app.get_name() +R"( add app -n MyApp -l C++ "\-O2 -WError" \\-s)"); + + app_subcommand->add_option("-p", path, "Path containing the project's yaml file."); app_subcommand->add_option("-n, name", obj_name, "The name of the app to add.")->required(); app_subcommand->add_option("-l, lang", lang, "Language this app will use.")->required(); app_subcommand->add_option("--comp, compile_options", copts, "Options for the compiler for this app.") @@ -153,12 +159,21 @@ namespace antler { ->transform(escape_transform); lib_subcommand = subcommand->add_subcommand("lib", "Add a new library to your project."); + lib_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( add lib MyLib C++ \\-O2 "\-s")" + + "\n\t" + app.get_name() +R"( ./path-to-project/ add lib -n MyLib -l C++ --comp -O2 --link -s)"); + lib_subcommand->add_option("-p", path, "Path containing the project's yaml file."); lib_subcommand->add_option("-n, name", obj_name, "The name of the library to add.")->required(); lib_subcommand->add_option("-l, lang", lang, "Language this library will use.")->required(); - lib_subcommand->add_option("--comp, compile_options", copts, "Options for the compiler for this app."); - lib_subcommand->add_option("--link, link_options", lopts, "Options for the linker for this app."); + lib_subcommand->add_option("--comp, compile_options", copts, "Options for the compiler for this app.") + ->transform(escape_transform); + lib_subcommand->add_option("--link, link_options", lopts, "Options for the linker for this app.") + ->transform(escape_transform); dep_subcommand = subcommand->add_subcommand("dep", "Add a new dependency to the project."); + dep_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( add dep MyApp MyDep)"); + dep_subcommand->add_option("-p", path, "Path containing the project's yaml file."); dep_subcommand->add_option("-o, obj", obj_name, "The name of the object to attach dependency to.")->required(); dep_subcommand->add_option("-d, dep", dep_name, "The name of the dependency.")->required(); dep_subcommand->add_option("-l, loc", location, "Location of the dependency."); @@ -168,6 +183,7 @@ namespace antler { /* TODO Add back after this release when we have the testing framework finished test_subcommand = subcommand->add_subcommand("test", "Add a new test to the project."); + test_subcommand->add_option("-p", path, "Path containing the project's yaml file.")->default_val("."); test_subcommand->add_option("-n, name", obj_name, "The name of the test to add.")->required(); test_subcommand->add_option("-c, command", cmd, "The test command to execute."); */ diff --git a/tools/build.hpp b/tools/build.hpp index 068b0024..7cedcf7f 100644 --- a/tools/build.hpp +++ b/tools/build.hpp @@ -13,8 +13,11 @@ namespace antler { struct build_project { inline build_project(CLI::App& app) { + path = system::fs::current_path().string(); subcommand = app.add_subcommand("build", "Build a project."); - subcommand->add_option("-p, path", path, "This is the path to the root of the project.")->default_val("."); + subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( build -j3)"); + subcommand->add_option("-p, path", path, "This is the path to the root of the project."); subcommand->add_option("-j, --jobs", jobs, "The number of submodules fetched at the same time.")->default_val(1); subcommand->add_flag("-c, --clean", clean, "This will force a clean build.")->default_val(false); } @@ -93,7 +96,7 @@ namespace antler { } CLI::App* subcommand = nullptr; - std::string path = ""; + std::string path; uint32_t jobs = 1; bool clean = false; }; diff --git a/tools/init.hpp b/tools/init.hpp index 6690b1a5..e8614fa7 100644 --- a/tools/init.hpp +++ b/tools/init.hpp @@ -10,8 +10,11 @@ namespace antler { struct init_project { inline init_project(CLI::App& app) { + path = system::fs::current_path().string(); subcommand = app.add_subcommand("init", "Initialize a new project creating the directory tree and a `project.yaml` file."); - subcommand->add_option("-p, path", path, "This is the root path to create the project in.")->default_val("."); + subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( init MyProjectName 1.0.0)"); + subcommand->add_option("-p, path", path, "The root path to create the project in.")->required(); subcommand->add_option("-n, project_name", name, "The name of the project.")->required(); subcommand->add_option("-v, version", version, "The version to store in the project file.")->default_val("0.0.0"); } @@ -29,10 +32,10 @@ namespace antler { system::info_log("Created project {0} at location {1}", name, path); return 0; } - + CLI::App* subcommand; std::string path; std::string name; std::string version; }; -} // namespace antler \ No newline at end of file +} // namespace antler diff --git a/tools/populate.hpp b/tools/populate.hpp index 60c7747f..6db91497 100644 --- a/tools/populate.hpp +++ b/tools/populate.hpp @@ -12,14 +12,17 @@ namespace antler { struct populate_project { inline populate_project(CLI::App& app) { + path = system::fs::current_path().string(); subcommand = app.add_subcommand("populate", "Populate a project's dependencies and CMake."); - subcommand->add_option("-p, path", path, "This is the path to the root of the project.")->default_val("."); + subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( populate ./path-to-project)"); + subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); subcommand->add_flag("-f, --force", force, "This flag will force a repopulation of the project.")->default_val(false); } int32_t exec() { auto proj = load_project(path); - + if (force || should_repopulate(proj)) { system::fs::remove_all(proj.path()/"build"); ANTLER_CHECK(project::populators::get(proj).populate(), "failed to populate dependencies"); @@ -28,9 +31,9 @@ namespace antler { system::info_log("Project population was successful!"); return 0; } - + CLI::App* subcommand = nullptr; - std::string path = ""; + std::string path; bool force = false; }; } // namespace antler diff --git a/tools/remove_from.hpp b/tools/remove_from.hpp index 73a9e3d6..ae4a94e4 100644 --- a/tools/remove_from.hpp +++ b/tools/remove_from.hpp @@ -67,15 +67,25 @@ namespace antler { remove_from_project(CLI::App& app) { path = system::fs::current_path().string(); subcommand = app.add_subcommand("remove", "Add an app, dependency, library or test to your project."); - subcommand->add_option("-p, path", path, "This must be the path to the `project.yml` or the path containing it.")->default_val("."); + subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); app_subcommand = subcommand->add_subcommand("app", "Remove app from the project."); + app_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( remove app MyApp)"); + app_subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); app_subcommand->add_option("-n, name", obj_name, "The name of the app to remove.")->required(); lib_subcommand = subcommand->add_subcommand("lib", "Remove lib from the project."); + lib_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( remove lib MyLib)"); + lib_subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); lib_subcommand->add_option("-n, name", obj_name, "The name of the library to add.")->required(); dep_subcommand = subcommand->add_subcommand("dep", "Remove a dependency from the project."); + dep_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( remove dep MyDep)" + + "\n\t" + app.get_name() +R"( remove dep MyDep MyApp)"); + dep_subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); dep_subcommand->add_option("-d, dep", dep_name, "The name of the dependency.")->required(); dep_subcommand->add_option("-o, obj", obj_name, "The name of the object the dependency is attached to."); diff --git a/tools/tests/add_and_update.py b/tools/tests/add_and_update.py index 5bcc503d..16af5dda 100644 --- a/tools/tests/add_and_update.py +++ b/tools/tests/add_and_update.py @@ -97,6 +97,12 @@ def test_app_update_options(): assert expect_subvalue(load_project(PROJECT_PATH)["apps"], "App3", "compile_options", "-O2") + # Test for a missing application + out, err = antler_in_proj_cmd(PROJECT_PATH, "update app NonexistingApp --comp \\\\-O1") + print(out) + print(err) + assert "Object NonexistingApp does not exist" in err + def test_lib_options(): """Add a library to the project and test its compile and link options can be updated with flags. diff --git a/tools/update.hpp b/tools/update.hpp index 01340262..d3e6bd7f 100644 --- a/tools/update.hpp +++ b/tools/update.hpp @@ -110,9 +110,13 @@ namespace antler { update_project(CLI::App& app) { path = system::fs::current_path().string(); subcommand = app.add_subcommand("update", "Update an app, dependency, library or test to your project."); - subcommand->add_option("-p, path", path, "This must be the path to the `project.yml` or the path containing it.")->default_val("."); + subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); - app_subcommand = subcommand->add_subcommand("app", "Remove app from the project."); + app_subcommand = subcommand->add_subcommand("app", "Update an app in the project."); + app_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( update app MyApp C++ \\-O2)" + + "\n\t" + app.get_name() +R"( update ./path-to-project/ app -n MyApp --comp -O2)"); + app_subcommand->add_option("-p", path, "Path containing the project's yaml file."); app_subcommand->add_option("-n, name", obj_name, "The name of the app to remove.")->required(); app_subcommand->add_option("-l, language", lang, "The language of the app."); app_subcommand->add_option("--comp, compile_options", copts, "The compile options used to build the app.") @@ -120,13 +124,22 @@ namespace antler { app_subcommand->add_option("--link, link_options", lopts, "The link options used to build the app.") ->transform(escape_transform); - lib_subcommand = subcommand->add_subcommand("lib", "Remove lib from the project."); + lib_subcommand = subcommand->add_subcommand("lib", "Update a lib in the project."); + lib_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( update lib MyLib C++ \\-O2 "\-s")" + + "\n\t" + app.get_name() +R"( update lib MyLib --link -s)"); + lib_subcommand->add_option("-p", path, "Path containing the project's yaml file."); lib_subcommand->add_option("-n, name", obj_name, "The name of the library to add.")->required(); lib_subcommand->add_option("-l, language", lang, "The language of the lib."); - lib_subcommand->add_option("--comp, compile_options", copts, "The compile options used to build the app."); - lib_subcommand->add_option("--link, link_options", lopts, "The link options used to build the app."); + lib_subcommand->add_option("--comp, compile_options", copts, "The compile options used to build the app.") + ->transform(escape_transform); + lib_subcommand->add_option("--link, link_options", lopts, "The link options used to build the app.") + ->transform(escape_transform); - dep_subcommand = subcommand->add_subcommand("dep", "Remove a dependency from the project."); + dep_subcommand = subcommand->add_subcommand("dep", "Update a dependency in the project."); + dep_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( update dep MyDep -l AntelopeIO/my_dep)"); + dep_subcommand->add_option("-p", path, "Path containing the project's yaml file."); dep_subcommand->add_option("-d, dep", dep_name, "The name of the dependency.")->required(); dep_subcommand->add_option("-o, object", obj_name, "The name of the object the dependency is attached to."); dep_subcommand->add_option("-l, location", loc, "The location of the dependency."); @@ -136,6 +149,10 @@ namespace antler { /* TODO Add back after this release when we have the testing framework finished test_subcommand = subcommand->add_subcommand("test", "Remove a test from the project."); + test_subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( update dep MyDep -l AntelopeIO/my_dep")"); + test_subcommand->add_option("-p", path, "Path containing the project's yaml file."); + test_subcommand->add_option("-p", path, "Path containing the project's yaml file."); test_subcommand->add_option("-n, name", dep_name, "The name of the test to remove.")->required(); */ diff --git a/tools/validate.hpp b/tools/validate.hpp index 6c537215..54527075 100644 --- a/tools/validate.hpp +++ b/tools/validate.hpp @@ -12,8 +12,11 @@ namespace antler { struct validate_project { inline validate_project(CLI::App& app) { + path = system::fs::current_path().string(); subcommand = app.add_subcommand("validate", "Validate a project."); - subcommand->add_option("-p, path", path, "This is the path to the root of the project.")->default_val("."); + subcommand->footer(std::string(R"(Examples:)") + + "\n\t" + app.get_name() +R"( validate)"); + subcommand->add_option("-p, path", path, "Path containing the project's yaml file."); subcommand->add_flag("-V, --verbose", verbose, "Verbose output."); } @@ -34,9 +37,9 @@ namespace antler { system::info_log("Valid project dependencies and all are reachable"); return 0; } - + CLI::App* subcommand = nullptr; - std::string path = ""; + std::string path; bool verbose = false; }; -} // namespace antler \ No newline at end of file +} // namespace antler