Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Corrected some help, added examples, and allow '-p' in final subcommands. #37

Merged
merged 9 commits into from
Apr 20, 2023
109 changes: 64 additions & 45 deletions docs/man/antler-proj.1
Original file line number Diff line number Diff line change
@@ -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 <command> [<args>]\f[R]
\f[C]antler-proj <command> [<args>]\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
Expand All @@ -34,84 +34,84 @@ initializes it.
.nf
\f[C]
Command arguments:
<path> Path to the root of the project. Here a \[ga]project.yaml\[ga] file will be created
<path> Path to the root of the project. Here a \[ga]project.yaml\[ga] file will be created
<project_name> 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> Path to the root of the project.
\-n <project_name> The name of the project.
\-v <version> The version to store in the project file.
-h,--help Print this help message and exit
-p <path> Path to the root of the project.
-n <project_name> The name of the project.
-v <version> 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 <path> 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 <path> This must be the path to the \[ga]project.yml\[ga] or the path containing it.
[path] Path to the root of the project.
<app,lib,dep> Type of an entity to work with
<app,lib,dep> 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 <path> 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 <path> This must be the path to the \[ga]project.yml\[ga] or the path containing it.
[path] Path to the root of the project.
<app,lib,dep> Type of an entity to work with
<app,lib,dep> 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 <path> 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 <path> This must be the path to the \[ga]project.yml\[ga] or the path containing it.
[path] Path to the root of the project.
<app,lib,dep> Type of an entity to work with
<app,lib,dep> 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
\f[C]\[dq]Loading of a project\[dq]\f[R] in the User\[cq]s guide.
.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
.IP
.nf
\f[C]
Command arguments:
\-h,\-\-help Print this help message and exit
\-p <path> 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 <path> 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.
Expand All @@ -129,31 +129,50 @@ 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> Path to the root of the project.
\-V,\-\-verbose Verbose output.
-h,--help Print this help message and exit
-p <path> 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.
.IP
.nf
\f[C]
Command arguments:
\-h,\-\-help Print this help message and exit
\-p <path> 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 <path> 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
Expand Down
69 changes: 42 additions & 27 deletions docs/man/antler-proj.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,79 +18,79 @@ 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.
mikelik marked this conversation as resolved.
Show resolved Hide resolved

**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> Path to the root of the project. Here a `project.yaml` file will be created
<path> Path to the root of the project. Here a `project.yaml` file will be created
<project_name> 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> Path to the root of the project.
-n <project_name> The name of the project.
-v <version> 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 <path> This must be the path to the `project.yml` or the path containing it.
[path] Path to the root of the project.
<app,lib,dep> Type of an entity to work with
<app,lib,dep> 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 <path> This must be the path to the `project.yml` or the path containing it.
[path] Path to the root of the project.
<app,lib,dep> Type of an entity to work with
<app,lib,dep> 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 <path> This must be the path to the `project.yml` or the path containing it.
[path] Path to the root of the project.
<app,lib,dep> Type of an entity to work with
<app,lib,dep> 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 <path> 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.

Expand All @@ -106,30 +106,45 @@ Command arguments:
-p <path> 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.

```
Command arguments:
-h,--help Print this help message and exit
-p <path> 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would antler-proj add lib MyLib C++ "-O2 -s" or similar work? if so, please add

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 00e8699

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
Please submit bug reports online at: <https://github.com/AntelopeIO/antler-proj/issues>

# SEE ALSO
Full documentation and sources at: <https://github.com/AntelopeIO/antler-proj>


5 changes: 3 additions & 2 deletions include/antler/project/project.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>/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 <typename Tag>
[[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;
};

Expand Down
Loading