Skip to content

Commit

Permalink
added readme file
Browse files Browse the repository at this point in the history
Signed-off-by: ALTHAF <althafasharaf02@gmail.com>
  • Loading branch information
Althaf66 committed Oct 21, 2024
1 parent ddde994 commit 4cbacb2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,13 @@ func goreleaserContainer(directoryArg *dagger.Directory, githubToken string) *da
WithEnvVariable("TINI_SUBREAPER", "true").
WithSecretVariable("GITHUB_TOKEN", token)
}

func (m *HarborCli) RunDoc(ctx context.Context, source *dagger.Directory) *dagger.Directory {
fmt.Println("Running doc.go file using Dagger...")
return dag.Container().
From("golang:latest").
WithMountedDirectory("/src", source).
WithWorkdir("/src/doc").
WithExec([]string{"go", "run", "doc.go"}).
WithWorkdir("/src").Directory("/src/doc")
}
41 changes: 41 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Harbor CLI Documentation

Welcome to the Harbor CLI documentation guide! This document outlines the steps to generate the CLI documentation files.

## Overview

The [doc.go](./doc.go) script is designed to create markdown files that detail the functions of commands available in the Harbor CLI. These files are generated based on the existing cli commands and it will be placed in the [cli-docs](./cli-docs) directory.

## Steps to Generate CLI Documentation

1. Clone the repository
```bash
git clone https://github.com/goharbor/harbor-cli.git
```

1. Navigate to the doc directory:
```bash
cd harbor-cli/doc
```
change your directory to the `doc` folder where the `doc.go` script is located.

2. Run the `doc.go` file:
```bash
go run doc.go
```
This generates markdown files for CLI commands that do not already exist in the [cli-docs](./cli-docs) directory.

## Generate Documentation using Dagger

Make sure you have latest [Dagger](https://docs.dagger.io/) installed in your system.

```bash
git clone https://github.com/goharbor/harbor-cli.git
cd harbor-cli
dagger call run-doc --source=. export --path=doc
```
This would runs the dagger function and generate markdown files in [cli-docs](./cli-docs).

### Note

- For any newly generated markdown files, ensure to set the weight according to the order you want them to appear.

0 comments on commit 4cbacb2

Please sign in to comment.