Skip to content

Commit 97f16bc

Browse files
Make refactors in favor of documentation (#95)
1 parent d4c0d3f commit 97f16bc

File tree

103 files changed

+1078
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1078
-575
lines changed

auto-docs/index.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const fs = require('fs');
2+
const recursive = require('recursive-readdir');
3+
const path = require('path');
4+
const _ = require('lodash');
5+
6+
7+
recursive(path.resolve(__dirname, '../lib/interface/cli/commands'), (err, files) => {
8+
9+
_.forEach(files, (file) => {
10+
if (!file.endsWith('.cmd.js')) {
11+
return;
12+
}
13+
14+
console.log(file);
15+
const command = require(file);
16+
17+
// dont document beta commands currently
18+
if (command.isBetaCommand()) {
19+
return;
20+
}
21+
22+
const docs = command.prepareDocs();
23+
24+
const { category } = docs;
25+
26+
// create a directory according to the category
27+
const dir = path.resolve(__dirname, `../docs-template/content/${(category || 'undefined').toLowerCase()}`);
28+
if (!fs.existsSync(dir)){
29+
fs.mkdirSync(dir);
30+
}
31+
32+
// create _index.md file if does not exist for the category
33+
const indexFile = path.resolve(dir, '_index.md');
34+
if (!fs.existsSync(indexFile)){
35+
fs.writeFileSync(indexFile, `+++\ntitle = "${category}"\n+++`);
36+
}
37+
38+
let finalFileString = '';
39+
40+
finalFileString += `${docs.header}\n\n`;
41+
finalFileString += `### Command\n\`${docs.command}\`\n\n`;
42+
finalFileString += `${docs.description}\n`;
43+
44+
if (docs.positionals.length) {
45+
finalFileString += `### Positionals\n\nOption | Default | Description\n--------- | ----------- | -----------\n${docs.positionals}`;
46+
}
47+
48+
if (docs.options.length) {
49+
finalFileString += `### Options\n\nOption | Default | Description\n--------- | ----------- | -----------\n${docs.options}`;
50+
}
51+
52+
53+
fs.writeFileSync(path.resolve(dir, `./${docs.title}.md`), finalFileString);
54+
});
55+
});

docs-template/config.toml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,44 @@
1-
theme = "docuapi"
1+
theme = "docdock"
22
baseurl = "http://cli.codefresh.io"
33
title = "Codefresh CLI Documentation"
44
publishDir = "../docs"
55
languageCode = "en-us"
6+
DefaultContentLanguage = "en"
67

78

8-
# Code higlighting settings
9-
pygmentsCodefences = true
10-
pygmentsCodeFencesGuesSsyntax = false
11-
pygmentsOptions = ""
12-
pygmentsStyle = "monokai"
13-
# The monokai stylesheet is included in the base template.
14-
pygmentsUseClasses = true
9+
pygmentsCodeFences = true
10+
pygmentsStyle = "monokailight"
1511

1612
[params]
17-
search = true
13+
editURL = "https://github.com/vjeantet/hugo-theme-docdock/edit/master/exampleSite/content/"
14+
showVisitedLinks = true # default is false
15+
themeStyle = "original" # "original" or "flex" # default "original"
16+
themeVariant = "" # choose theme variant "green", "gold" , "gray", "blue" (default)
17+
ordersectionsby = "weight" # ordersectionsby = "title"
18+
disableHomeIcon = false # default is false
19+
disableSearch = false # default is false
20+
disableNavChevron = false # set true to hide next/prev chevron, default is false
21+
highlightClientSide = false # set true to use highlight.pack.js instead of the default hugo chroma highlighter
1822

19-
# Configure the language example tabs.
20-
[[params.language_tabs]]
21-
key = "cli"
22-
name = "Cli"
2323

24-
#Languages
25-
[languages]
24+
[outputs]
25+
home = [ "HTML", "RSS", "JSON"]
2626

27-
[languages.en]
28-
languageName = "English"
29-
weight = 2
27+
28+
[[menu.shortcuts]]
29+
pre = "<h3>More</h3>"
30+
name = "<i class='fa fa-github'></i> Github repo"
31+
identifier = "ds"
32+
url = "https://github.com/codefresh-io/cli"
33+
weight = 10
34+
35+
[[menu.shortcuts]]
36+
name = "<i class='fa fa-camera'></i> Examples"
37+
url = "/Examples"
38+
weight = 11
39+
40+
[[menu.shortcuts]]
41+
name = "<i class='fa fa-bookmark'></i> Codefresh Documentation"
42+
identifier = "hugodoc"
43+
url = "https://docs.codefresh.io"
44+
weight = 20

docs-template/content/Installation.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs-template/content/_header.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
+++
2+
title = "header"
3+
description = ""
4+
date = "2017-04-24T18:36:24+02:00"
5+
+++
6+
Codefresh CLI Documentation
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
+++
2+
title = "Create authentication context"
3+
+++
4+
5+
### Command
6+
`codefresh auth create-context [name]`
7+
8+
Create or update an authentication context
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
name | default | Context name
14+
### Options
15+
16+
Option | Default | Description
17+
--------- | ----------- | -----------
18+
--url | https://g.codefresh.io | Codefresh system custom url
19+
--api-key | | API key
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
+++
2+
title = "Get activated context"
3+
+++
4+
5+
### Command
6+
`codefresh auth current-context`
7+
8+
Get the current activated authentication context
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
+++
2+
title = "Get all contexts"
3+
+++
4+
5+
### Command
6+
`codefresh auth get-contexts`
7+
8+
Get all possible authentication contexts
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
+++
2+
title = "Set active context"
3+
+++
4+
5+
### Command
6+
`codefresh auth use-context <name>`
7+
8+
Set the current active authentication context
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
context-name | | a context-name that exists in cfconfig file

docs-template/content/authentication.md renamed to docs-template/content/authentication/_index.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
---
2-
weight: 30
3-
title: Authentication
4-
---
5-
6-
# Authentication
1+
+++
2+
title = "Authentication"
3+
description = "asd"
4+
date = "2017-04-24T18:36:24+02:00"
5+
+++
76

87
## Basic Usage
98
In order to start working with the cli you will need to update the authentication configuration. <br />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
+++
2+
title = "Get a single build"
3+
+++
4+
5+
### Command
6+
`codefresh get builds [id]`
7+
8+
Get a specific builds or an array of builds
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
id | | Build id
14+
### Options
15+
16+
Option | Default | Description
17+
--------- | ----------- | -----------
18+
--limit | 25 | Limit amount of returned results
19+
--page | 1 | Paginated page
20+
--status | | Filter results by statuses
21+
--trigger | | Filter results by triggers
22+
--pipeline-id | | Filter results by pipeline id
23+
--pipeline-name | | Filter results by pipeline name
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
+++
2+
title = "Restart a build"
3+
+++
4+
5+
### Command
6+
`codefresh restart <id>`
7+
8+
Restart a build by its id
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
id | | Build id
14+
### Options
15+
16+
Option | Default | Description
17+
--------- | ----------- | -----------
18+
--detach | | Run build and print workflow ID
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
+++
2+
title = "Show logs"
3+
+++
4+
5+
### Command
6+
`codefresh logs <id>`
7+
8+
Show logs of a build
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
id | | Pipeline id
14+
### Options
15+
16+
Option | Default | Description
17+
--------- | ----------- | -----------
18+
--f | | Continue showing build logs until it will finish
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
+++
2+
title = "Terminate a build"
3+
+++
4+
5+
### Command
6+
`codefresh terminate <id>`
7+
8+
Terminate a build by its id
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
id | | Build id
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
+++
2+
title = "Wait for a build condition"
3+
+++
4+
5+
### Command
6+
`codefresh wait <id..>`
7+
8+
Wait until a condition will be met on a build
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
id | | Build id
14+
### Options
15+
16+
Option | Default | Description
17+
--------- | ----------- | -----------
18+
--status | | Build status
19+
--debug | | Show debug output until the condition will be met
20+
--timeout | 30 | Define a timeout for the wait operation in minutes
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
+++
2+
title = "Builds"
3+
+++
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
+++
2+
title = "Create a composition"
3+
+++
4+
5+
### Command
6+
`codefresh create composition [name]`
7+
8+
Create a composition
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
name | | Name of composition
14+
### Options
15+
16+
Option | Default | Description
17+
--------- | ----------- | -----------
18+
--variable | | Variables list
19+
--advanced | | Advanced composition
20+
--yaml | | Path to yaml file to use to create the resource
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
+++
2+
title = "Delete a composition"
3+
+++
4+
5+
### Command
6+
`codefresh delete composition [name]`
7+
8+
Delete a composition
9+
### Positionals
10+
11+
Option | Default | Description
12+
--------- | ----------- | -----------
13+
name | | Composition name

0 commit comments

Comments
 (0)