Skip to content

Commit

Permalink
add doc content that explains the project name of the examples (#1027)
Browse files Browse the repository at this point in the history
Close #967
  • Loading branch information
geometryolife authored Oct 24, 2023
1 parent affcb65 commit 6e87a95
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
26 changes: 26 additions & 0 deletions docs/website/pages/docs/example-guides.en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

Here are all Rooch examples introduction and source code indices.

## About the sample project naming explanation

Rooch provides the command `rooch move new` to automatically create and initialize projects. When we want to write a new contract project, we can use this command to simplify our initialization work.

We can use any legal character as the project name, including `-`, but when we use a project name with `-`, the `rooch move new` command will automatically use the project name as the address of this project.

For example:

```shell
move rooch new hello-world
```

However, `-` is not a legal character for naming addresses (variables), so after we create the project using `rooch move new`, be sure to check the project address alias in the `Move.toml` file for illegal characters.

Use `rooch move new` to create a project (name) with `-`. We recommend manually modifying the `Move.toml` file and replacing `-` with `_`.

Another way is to directly use `_` as the hyphen for the project name word when creating the project.

For example:

```shell
move rooch new hello_world
```

In Rooch's `examples`, the names of the projects we create use `_` connection. As for the actual development, which style to use, please decide according to your preferences.

## Basic object

This example introduces how to use the Rooch object.
Expand Down
34 changes: 30 additions & 4 deletions docs/website/pages/docs/example-guides.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# Example guides
# 示例指南

Here are all Rooch examples introduction and source code indices.
这里是所有 Rooch 示例介绍和源代码索引。

## 关于示例项目命名解释

Rooch 提供自动创建并初始化项目的命令 `rooch move new`,当我们要编写新的合约项目时,可以利用这个命令简化我们的初始化工作。

我们可以使用任何合法字符来作为项目名,包括 `-`,但是,当我们使用带有 `-` 的项目名时,`rooch move new` 命令会自动将项目名用作这个项目的地址。

例如:

```shell
move rooch new hello-world
```

然而,`-` 不是命名地址(变量)的合法字符,所以当我们使用 `rooch move new` 创建好项目后,务必检查 `Move.toml` 文件中的项目地址别名是否存在非法字符。

使用 `rooch move new` 创建带有 `-` 的项目(名),我们推荐手动修改 `Move.toml` 文件,将 `-` 替换为 `_`

另一种方式是,创建项目时,直接使用 `_` 作为项目名称单词的连接符号。

例如:

```shell
move rooch new hello_world
```

在 Rooch 的 `examples` 中,我们创建的项目的名字统一使用 `_` 连接,至于实际开发中,使用那种风格,请根据您的喜好决定。

## Basic object

Expand All @@ -12,7 +38,7 @@ This example introduces how to use the Rooch object.

## Blog

This example introduces how to use a low-code tool to develop a blog sample application.
本示例介绍如何使用低代码工具开发博客示例应用程序。

### Source code

Expand Down Expand Up @@ -86,7 +112,7 @@ This example introduces how to use a low-code tool to develop a blog sample appl

### References

[Read private generic functions in one article](https://rooch.network/blog/read-private-generics-in-one-article)
[一文读懂私有泛型函数](https://rooch.network/blog/read-private-generics-in-one-article)

## Publish modules

Expand Down

0 comments on commit 6e87a95

Please sign in to comment.