https://github.com/aelfproject/aelf-cli
CLI implementation in C#
https://github.com/aelfproject/aelf-cli
Last synced: about 1 year ago
JSON representation
CLI implementation in C#
- Host: GitHub
- URL: https://github.com/aelfproject/aelf-cli
- Owner: AElfProject
- Created: 2021-11-19T20:51:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-07T05:39:58.000Z (about 3 years ago)
- Last Synced: 2023-07-21T11:01:20.046Z (almost 3 years ago)
- Language: C#
- Size: 414 KB
- Stars: 1
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README-zh.md
Awesome Lists containing this project
README
# AElf.Cli
## 通过本地代码安装aelf命令
1. cd到src/AElf.Cli目录下,执行`dotnet pack`
2. 当前目录生成`nupkg`文件夹,且文件夹中包含文件`AElf.Cli.*.nupkg`,执行:
```shell
dotnet tool install --global --add-source ./nupkg aelf.cli
```
3. 以上步骤成功以后,即可使用`aelf`命令,如启动一个单节点:
```shell
aelf start
```
4. 修改代码后,需要重新执行pack,然后使用`dotnet tool update`升级aelf命令:
```shell
dotnet pack
dotnet tool update --global --add-source ./nupkg aelf.cli
```
## 添加新的命令
1. 在Commands目录下添加新的文件`*Command.cs`,让它继承自`IAElfCommand`接口;
2. 分别实现以下三个方法:
- ExecuteAsync:执行该命令的逻辑
- GetUsageInfo:该命令的帮助文档,如使用方法等
- GetShortDescription:该命令的简单介绍
3. 在`AElfCliModule.cs`文件中注册该命令,格式参考HelpCommand、StartCommand等。
4. 使用`dotnet pack`和`dotnet tool update --global --add-source ./nupkg aelf.cli`命令重新安装到本地即可测试新的命令。