Skip to content

Commit

Permalink
📝 add CLI documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdd committed Aug 25, 2024
1 parent f8ceb67 commit bfa4744
Show file tree
Hide file tree
Showing 7 changed files with 299 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ tasks:
cmds:
- go test -v ./...

doc:
desc: "Generate documentation"
cmds:
- sh scripts/gen_cli_doc.sh

"docker:build":
desc: "Build the docker image"
cmds:
Expand Down
2 changes: 1 addition & 1 deletion cmd/flowg/admin_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/spf13/cobra"
func NewAdminRoleCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "role",
Short: "role commands (please run while the server is down)",
Short: "Role related admin commands (please run while the server is down)",
}

cmd.AddCommand(
Expand Down
2 changes: 1 addition & 1 deletion cmd/flowg/admin_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/spf13/cobra"
func NewAdminTokenCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "token",
Short: "Personal Access Token commands (please run while the server is down)",
Short: "Personal Access Token related admin commands (please run while the server is down)",
}

cmd.AddCommand(
Expand Down
2 changes: 1 addition & 1 deletion cmd/flowg/admin_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/spf13/cobra"
func NewAdminUserCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "user",
Short: "User commands (please run while the server is down)",
Short: "User related admin commands (please run while the server is down)",
}

cmd.AddCommand(
Expand Down
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ logs using a visual pipeline builder. It handles structured logs without
requiring predefined schemas and relies on
[BadgerDB](https://dgraph.io/docs/badger/) as its storage backend.

## Reference

- [Command Line Interface](./cli.md)

## Guides

- [Filtering Data](./guides/filtering.md)
Expand Down
206 changes: 206 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Command Line Interface

```
Low-Code log management solution
Usage:
flowg [command]
Available Commands:
admin Admin commands (please run while the server is down)
help Help about any command
serve Start FlowG standalone server
Flags:
-h, --help help for flowg
Use "flowg [command] --help" for more information about a command.
```

## 1. `flowg serve`

```
Start FlowG standalone server
Usage:
flowg serve [flags]
Flags:
--auth-dir string Path to the auth database directory (default "./data/auth")
--bind string Address to bind the server to (default ":5080")
--config-dir string Path to the config directory (default "./data/config")
-h, --help help for serve
--log-dir string Path to the log database directory (default "./data/logs")
--verbose Enable verbose logging
```

## 2. `flowg admin`

```
Admin commands (please run while the server is down)
Usage:
flowg admin [command]
Available Commands:
role Role related admin commands (please run while the server is down)
token Personal Access Token related admin commands (please run while the server is down)
user User related admin commands (please run while the server is down)
Flags:
-h, --help help for admin
Use "flowg admin [command] --help" for more information about a command.
```

### 2.1. `flowg admin role`

```
Role related admin commands (please run while the server is down)
Usage:
flowg admin role [command]
Available Commands:
create Create a new role
delete Delete an existing role
list List existing roles
Flags:
-h, --help help for role
Use "flowg admin role [command] --help" for more information about a command.
```

#### 2.1.1. `flowg admin role create`

```
Create a new role
Usage:
flowg admin role create [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for create
--name string Name of the role
```

#### 2.1.2. `flowg admin role delete`

```
Delete an existing role
Usage:
flowg admin role delete [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for delete
--name string Name of the role
```

#### 2.1.3. `flowg admin role list`

```
List existing roles
Usage:
flowg admin role list [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for list
```

### 2.2. `flowg admin user`

```
User related admin commands (please run while the server is down)
Usage:
flowg admin user [command]
Available Commands:
create Create a new user
delete Delete an existing user
list List existing users
Flags:
-h, --help help for user
Use "flowg admin user [command] --help" for more information about a command.
```

#### 2.2.1. `flowg admin user create`

```
Create a new user
Usage:
flowg admin user create [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for create
--name string Name of the user
--password string Password of the user
```

#### 2.2.2. `flowg admin user delete`

```
Delete an existing user
Usage:
flowg admin user delete [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for delete
--name string Name of the user
```

#### 2.2.3. `flowg admin user list`

```
List existing users
Usage:
flowg admin user list [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for list
```

### 2.3. `flowg admin token`

```
Personal Access Token related admin commands (please run while the server is down)
Usage:
flowg admin token [command]
Available Commands:
create Create a new Personal Access Token
Flags:
-h, --help help for token
Use "flowg admin token [command] --help" for more information about a command.
```

#### 2.3.1. `flowg admin token create`

```
Create a new Personal Access Token
Usage:
flowg admin token create [flags]
Flags:
--auth-dir string Path to the log database directory (default "./data/auth")
-h, --help help for create
--user string Name of the user
```
81 changes: 81 additions & 0 deletions scripts/gen_cli_doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/sh

cat > ./docs/cli.md <<EOF
# Command Line Interface
\`\`\`
$(./bin/flowg --help)
\`\`\`
## 1. \`flowg serve\`
\`\`\`
$(./bin/flowg serve --help)
\`\`\`
## 2. \`flowg admin\`
\`\`\`
$(./bin/flowg admin --help)
\`\`\`
### 2.1. \`flowg admin role\`
\`\`\`
$(./bin/flowg admin role --help)
\`\`\`
#### 2.1.1. \`flowg admin role create\`
\`\`\`
$(./bin/flowg admin role create --help)
\`\`\`
#### 2.1.2. \`flowg admin role delete\`
\`\`\`
$(./bin/flowg admin role delete --help)
\`\`\`
#### 2.1.3. \`flowg admin role list\`
\`\`\`
$(./bin/flowg admin role list --help)
\`\`\`
### 2.2. \`flowg admin user\`
\`\`\`
$(./bin/flowg admin user --help)
\`\`\`
#### 2.2.1. \`flowg admin user create\`
\`\`\`
$(./bin/flowg admin user create --help)
\`\`\`
#### 2.2.2. \`flowg admin user delete\`
\`\`\`
$(./bin/flowg admin user delete --help)
\`\`\`
#### 2.2.3. \`flowg admin user list\`
\`\`\`
$(./bin/flowg admin user list --help)
\`\`\`
### 2.3. \`flowg admin token\`
\`\`\`
$(./bin/flowg admin token --help)
\`\`\`
#### 2.3.1. \`flowg admin token create\`
\`\`\`
$(./bin/flowg admin token create --help)
\`\`\`
EOF

0 comments on commit bfa4744

Please sign in to comment.