Skip to content

Commit 6ed883c

Browse files
Patrick BajaoIgor Drozdov
andcommitted
Merge branch 'id-add-documentation-to-command' into 'main'
Add developer documentation to command package See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/594 Merged-by: Patrick Bajao <[email protected]> Approved-by: Patrick Bajao <[email protected]> Co-authored-by: Igor Drozdov <[email protected]>
2 parents 2094323 + 3183c96 commit 6ed883c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

internal/command/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
stage: Create
3+
group: Source Code
4+
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
5+
---
6+
7+
# Overview
8+
9+
This package consists of a set of packages that are responsible for executing a particular command/feature/operation.
10+
The full list of features can be viewed [here](https://gitlab.com/gitlab-org/gitlab-shell/-/blob/main/doc/features.md).
11+
The commands implement the common interface:
12+
13+
```go
14+
type Command interface {
15+
Execute(ctx context.Context) error
16+
}
17+
```
18+
19+
A command is executed by running the `Execute` method. The execution logic mostly shares the common pattern:
20+
21+
- Parse the arguments and validate them.
22+
- Communicate with GitLab Rails using [gitlabnet](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/internal/gitlabnet) package. For example, it can be checking whether a client is authorized to execute this particular command or asking for a personal access token in order to return it to the client.
23+
- If a command is related to Git operations, establish a connection with Gitaly using [handler](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/internal/handler) and [gitaly](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/internal/gitaly) packages and provide two-way communication between Gitaly and the client.
24+
- Return results to the client.
25+
26+
This package is being used to build a particular command based on the passed arguments in the following files that are under `cmd` directory:
27+
- [cmd/gitlab-shell/command](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/cmd/gitlab-shell/command)
28+
- [cmd/check/command](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/cmd/check/command)
29+
- [cmd/gitlab-shell-authorized-keys-check/command](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/cmd/gitlab-shell-authorized-keys-check/command)
30+
- [cmd/gitlab-shell-authorized-principals-check/command](https://gitlab.com/gitlab-org/gitlab-shell/-/tree/main/cmd/gitlab-shell-authorized-principals-check/command)

0 commit comments

Comments
 (0)