Skip to content

Commit 84e7aae

Browse files
committed
update cli readme
1 parent df1fb9d commit 84e7aae

File tree

1 file changed

+49
-10
lines changed

1 file changed

+49
-10
lines changed

router-cli/README.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,40 @@ cargo build --release
1212

1313
## Usage
1414

15+
### Initialize Configuration
16+
17+
Create a new configuration file with default template:
18+
19+
```bash
20+
# Create in current directory
21+
gwrs init
22+
23+
# Create in specific directory
24+
gwrs init /path/to/directory
25+
```
26+
1527
### Upload Configuration
1628

17-
Upload a YAML configuration file to the router:
29+
Upload a YAML configuration file to the router. You can use either the direct flag or the config subcommand:
1830

1931
```bash
20-
# Using username and password
21-
gwrs -u USERNAME -p PASSWORD --config config.yaml
32+
# Using direct flag
33+
gwrs --config config.yaml -u USERNAME -p PASSWORD
34+
35+
# Using config subcommand
36+
gwrs config config.yaml -u USERNAME -p PASSWORD
2237

2338
# Using environment variables
2439
export GWRS_USER=admin
2540
export GWRS_PASS=password
2641
gwrs --osenv --config config.yaml
42+
# or
43+
gwrs config config.yaml --osenv
2744

2845
# Specify custom API URL
29-
gwrs -u USERNAME -p PASSWORD --api-url http://router-api:3000 --config config.yaml
46+
gwrs --config config.yaml -u USERNAME -p PASSWORD --url http://router-api:3000
47+
# or
48+
gwrs config config.yaml -u USERNAME -p PASSWORD --url http://router-api:3000
3049
```
3150

3251
### Configuration File Format
@@ -66,25 +85,45 @@ proxy:
6685
- `GWRS_USER`: Username for API authentication
6786
- `GWRS_PASS`: Password for API authentication
6887

69-
## Options
88+
## Global Options
89+
90+
These options can be used with any command:
7091

7192
- `-u, --user`: Username for API authentication
7293
- `-p, --pass`: Password for API authentication
7394
- `--osenv`: Use credentials from environment variables
74-
- `--api-url`: API base URL (default: http://localhost:24042)
75-
- `--config`: Path to the configuration file
95+
- `--url`: API base URL (default: http://localhost:24042)
96+
97+
## Commands
98+
99+
### init [LOCATION]
100+
Initialize a new configuration file. If LOCATION is not specified, creates in the current directory.
101+
102+
### config CONFIG
103+
Upload a configuration file to the router. CONFIG is the path to your configuration file.
76104

77105
## Examples
78106

79107
```bash
80-
# Basic usage
81-
gwrs -u admin -p password --config my-gateway-config.yaml
108+
# Initialize new configuration
109+
gwrs init
110+
gwrs init /path/to/directory
111+
112+
# Upload configuration (direct flag)
113+
gwrs --config my-gateway-config.yaml -u admin -p password
114+
115+
# Upload configuration (subcommand)
116+
gwrs config my-gateway-config.yaml -u admin -p password
82117
83118
# Use environment variables for credentials
84119
gwrs --osenv --config my-gateway-config.yaml
120+
# or
121+
gwrs config my-gateway-config.yaml --osenv
85122
86123
# Specify custom API URL
87-
gwrs -u admin -p password --api-url http://router-api:8080 --config my-gateway-config.yaml
124+
gwrs --config my-gateway-config.yaml -u admin -p password --url http://router-api:8080
125+
# or
126+
gwrs config my-gateway-config.yaml -u admin -p password --url http://router-api:8080
88127
```
89128

90129
## Debug Logging

0 commit comments

Comments
 (0)