Skip to content

Commit 27af106

Browse files
docs: 更新文档,添加 password 输出说明
- 在 README.md 中添加 password 字段到输出说明 - 在 README.md 输出示例中添加 password 字段 - 在 README.md 模板示例中添加 password 输出 - 在 TEMPLATE.md 可用数据中添加 Password 和 Projects 字段 - 在 TEMPLATE.md 示例中添加 password 输出示例 - 完善文档,使 password 输出功能有完整的说明
1 parent 8c9f563 commit 27af106

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ token:
204204
./bin/gitlab-cli user create -f config.yaml -o output.yaml
205205
```
206206

207+
输出包含创建的所有资源信息:
208+
- 用户信息:username, email, name, user_id, password
209+
- Token 信息:value, scope, expires_at(如果配置了 token)
210+
- 组信息:name, path, group_id, visibility(如果配置了 groups)
211+
- 项目信息:name, path, project_id, description, visibility, web_url(包括组下的项目和用户级项目)
212+
207213
输出格式:
208214

209215
```yaml
@@ -212,6 +218,7 @@ users:
212218
213219
name: tektoncd-test
214220
user_id: 24
221+
password: MyStr0ng!Pass2024
215222
token:
216223
value: glpat-TXLgrsMwyVt5obFqkDny
217224
scope:
@@ -285,6 +292,9 @@ toolchains:
285292
username: {{ .Username }}
286293
email: {{ .Email }}
287294
user_id: {{ .UserID }}
295+
{{- if .Password }}
296+
password: {{ .Password }}
297+
{{- end }}
288298
{{- if .Token }}
289299
token:
290300
value: {{ .Token.Value }}

docs/TEMPLATE.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,30 @@ GitLab CLI 支持使用自定义模板来格式化输出结果,让你可以按
3838
├── .Email // 邮箱
3939
├── .Name // 姓名
4040
├── .UserID // 用户 ID
41+
├── .Password // 用户密码
4142
├── .Token // Personal Access Token (可能为空)
4243
│ ├── .Value // Token 值
4344
│ ├── .Scope // 权限范围数组
4445
│ └── .ExpiresAt // 过期时间
45-
└── .Groups // 组数组
46-
├── .Name // 组名
47-
├── .Path // 组路径
48-
├── .GroupID // 组 ID
49-
├── .Visibility // 可见性
50-
└── .Projects // 项目数组
51-
├── .Name // 项目名
52-
├── .Path // 项目路径
53-
├── .ProjectID // 项目 ID
54-
├── .Description // 描述
55-
├── .Visibility // 可见性
56-
└── .WebURL // Web URL
46+
├── .Groups // 组数组
47+
│ ├── .Name // 组名
48+
│ ├── .Path // 组路径
49+
│ ├── .GroupID // 组 ID
50+
│ ├── .Visibility // 可见性
51+
│ └── .Projects // 组下的项目数组
52+
│ ├── .Name // 项目名
53+
│ ├── .Path // 项目路径
54+
│ ├── .ProjectID // 项目 ID
55+
│ ├── .Description // 描述
56+
│ ├── .Visibility // 可见性
57+
│ └── .WebURL // Web URL
58+
└── .Projects // 用户级项目数组(不属于任何组)
59+
├── .Name // 项目名
60+
├── .Path // 项目路径
61+
├── .ProjectID // 项目 ID
62+
├── .Description // 描述
63+
├── .Visibility // 可见性
64+
└── .WebURL // Web URL
5765
```
5866

5967
### 基础语法
@@ -64,6 +72,9 @@ GitLab CLI 支持使用自定义模板来格式化输出结果,让你可以按
6472
username: {{ .Username }}
6573
email: {{ .Email }}
6674
user_id: {{ .UserID }}
75+
{{- if .Password }}
76+
password: {{ .Password }}
77+
{{- end }}
6778
```
6879

6980
#### 2. 遍历用户列表
@@ -144,6 +155,9 @@ toolchains:
144155
username: {{ .Username }}
145156
email: {{ .Email }}
146157
user_id: {{ .UserID }}
158+
{{- if .Password }}
159+
password: {{ .Password }}
160+
{{- end }}
147161
{{- if .Token }}
148162
token:
149163
value: {{ .Token.Value }}

0 commit comments

Comments
 (0)