Skip to content

Commit

Permalink
feat: update cli
Browse files Browse the repository at this point in the history
  • Loading branch information
richerfu committed Apr 18, 2024
1 parent 714cfcf commit dce2a4c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions .vitepress/BasicSideBar.mts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const BasicSideBar: DefaultTheme.SidebarItem[] = [
items: [
{ text: "Init", link: "/docs/cli/init" },
{ text: "Build", link: "/docs/cli/build" },
{ text: "Artifact", link: "/docs/cli/artifact" },
],
},
{
Expand Down
25 changes: 25 additions & 0 deletions src/docs/cli/artifact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
editLink: true
---

# Artifact

This command will help us to generate the package for `ohpm`.

## Usage

Standard command will be:

```shell
ohrs artifact
```


## Arguments

It supports some special options.

| Options | description | type | default |
|---------|:--------------------------------------------------------------------------------------------------------|:---------|:----------|
| dist | The build command should be aligned and kept consistent with the `dist` parameter in the build command. | `string` | `dist` |
| package | The name of the final har package | `string` | `package` |
4 changes: 2 additions & 2 deletions src/docs/cli/build.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
editLink: true
outline: "deep"
---

# Build

As another useful subcommand, it helps us to build the final binary and generate `.d.ts`. Standard command will be:

```shell
cargo build
ohrs build
```

It supports some special options.

| Options | description | type | default |
|---------|:------------------------------------------------------------------------------------------------------|:----------|:--------|
| release | build mode,if it be set with true, project will build with `release` mode | `boolean` | false |
| compact | Generate folder struct,if it be set with true, the final dist folder will not be nest folder. | `boolean` | false |
| dist | The final binary's folder | `string` | dist |
| strip | Use `llvm-strip` to reduce the size of the binary files. Set the mode to true if it's in release mode | `boolean` | true |

Expand Down
11 changes: 10 additions & 1 deletion src/docs/cli/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ editLink: true

`ohrs` provide some useful subcommand to help us initial and build project.

## Usage

`init` is a subcommand with `ohrs`, a standard command just be here:

```shell
Expand All @@ -25,4 +27,11 @@ And the final prebuild binary's name will be `libxx.so`.

::: danger Don't do it
❌ Don't use some special name. For example: `test` `crate` `fn` etc.
:::
:::

## Arguments


| Options | description | type | default |
|---------|:----------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------|:--------|
| package | This will generate an OHPM package, which won't be created by default. If you input a string, it will replace the `name` field in oh-package.json5. | `boolean \| string` | false |

0 comments on commit dce2a4c

Please sign in to comment.