Skip to content

Commit 8ce8da9

Browse files
authored
Merge pull request #26 from TeoDev1611/main
Change the actions and the code owners, fix the doc generator and modularize the gen command and add support for viper
2 parents ff07f51 + 41d5e05 commit 8ce8da9

File tree

14 files changed

+67
-46
lines changed

14 files changed

+67
-46
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
* @TeoDev1611
2-
*.go @Polibov
2+
*.go @SantiagoVA

.github/dependabot.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
1+
52

63
version: 2
74
updates:

.github/issue-close-app.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
# Comment that will be sent if an issue is judged to be closed.
2-
comment: "This issue is closed because it does not meet our issue template. Please read it."
1+
2+
comment: "This issue is closed by the Bot check the issue template for the issue not close."
33
issueConfigs:
4-
# There can be several configs for different kind of issues.
54
- content:
6-
# Example 1: bug report
7-
- "Expected Behavior"
8-
- "Current Behavior"
9-
- "Steps to Reproduce"
10-
- "Detailed Description"
5+
# Template: bug report
6+
- "Describe the bug"
7+
- "To Reproduce"
8+
- "Desktop (please complete the following information):"
9+
- "Additional context"
1110
- content:
12-
# Example 2: feature request
13-
- "Motivation / Use Case"
14-
- "Expected Behavior"
15-
- "Other Information"
16-
# Optional configuration:
17-
#
18-
# whether the keywords are case-insensitive
19-
# default value is false, which means keywords are case-sensitive
20-
caseInsensitive: false
21-
# the label that will be added when the bot close an issue
22-
# The bot will only add a label if this property is set.
11+
# Template: feature request
12+
- "Is your feature request related to a problem? Please describe."
13+
- "Describe the solution you'd like"
14+
- "Describe alternatives you've considered"
15+
- Additional context
16+
caseInsensitive: true
2317
label: "closed by bot"
24-
# The bot will ignore any issues that are opened or reopened by the user names in exception
25-
exception:
26-
- "username1"
27-
- "username2"
28-
# The issue is judged to be legal if it includes all keywords from any of these two configs.
29-
# Or it will be closed by the app.
18+

cmd/doc.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ limitations under the License.
1616
package cmd
1717

1818
import (
19+
docGen "github.com/Moldy-Community/moldy/core/doc-generator"
1920
"github.com/Moldy-Community/moldy/utils/functions"
2021
"github.com/spf13/cobra"
21-
"github.com/spf13/cobra/doc"
2222
)
2323

2424
var (
@@ -39,8 +39,7 @@ This application is a tool to generate the needed files
3939
to quickly create a Cobra application.`,
4040
Run: func(cmd *cobra.Command, args []string) {
4141
if generateFlg {
42-
err := doc.GenMarkdownTree(rootCmd, "./moldyDoc")
43-
functions.CheckErrors(err, "Code 2", "Error in generate the documentation for moldy", "Report the error on github or re run with sudo")
42+
docGen.GenDocTree(rootCmd)
4443
} else if openFlg {
4544
functions.OpenBrowser("https://moldybook.netlify.app/")
4645
} else if contribFlg {

cmd/packages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ limitations under the License.
1616
package cmd
1717

1818
import (
19+
"github.com/Moldy-Community/moldy/core/packages"
1920
"github.com/Moldy-Community/moldy/utils/colors"
20-
"github.com/Moldy-Community/moldy/utils/functions/packages"
2121
"github.com/spf13/cobra"
2222
)
2323

cmd/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"os"
66

7-
"github.com/Moldy-Community/moldy/utils/functions/packages"
7+
"github.com/Moldy-Community/moldy/core/packages"
88
"github.com/olekukonko/tablewriter"
99
"github.com/spf13/cobra"
1010
)

core/config/configFile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
/* Add the default values, paths, aliases and config name and type */
1111
var (
1212
defaults = map[string]interface{}{
13-
"moldyPackages": map[string]string{
13+
"moldyPackageInfo": map[string]string{
1414
"name": "none",
1515
"version": "none",
1616
"author": "Example Author",

core/doc-generator/generator.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package docgenerator
2+
3+
import (
4+
"bytes"
5+
"os"
6+
7+
"github.com/Moldy-Community/moldy/utils/functions"
8+
"github.com/spf13/cobra"
9+
"github.com/spf13/cobra/doc"
10+
)
11+
12+
func moldyDocFolder() {
13+
_, err := os.Stat("moldyDoc")
14+
15+
if os.IsNotExist(err) {
16+
errDir := os.MkdirAll("moldyDoc", 0755)
17+
functions.CheckErrors(errDir, "Code 2", "Error in create the moldyDoc folder", "Report the error on github or re run with sudo")
18+
}
19+
}
20+
21+
func GenDocTree(cmd *cobra.Command) {
22+
moldyDocFolder()
23+
errDoc := doc.GenMarkdownTree(cmd, "./moldyDoc")
24+
functions.CheckErrors(errDoc, "Code 2", "Error in generate the documentation for moldy", "Report the error on github or re run with sudo")
25+
}
26+
27+
func DocCommand(cmd *cobra.Command) {
28+
moldyDocFolder()
29+
out := new(bytes.Buffer)
30+
err := doc.GenMarkdown(cmd, out)
31+
functions.CheckErrors(err, "Code 2", "Error in print out the doc for the command", "Report the error on github or re run with sudo")
32+
}
File renamed without changes.

utils/functions/packages/get.go renamed to core/packages/get.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func GetId(id string) (getOne, error) {
3636
}
3737

3838
if dataStruct.Error {
39-
return dataStruct, errors.New("Not data found")
39+
return dataStruct, errors.New("not data found")
4040
}
4141

4242
return dataStruct, nil

0 commit comments

Comments
 (0)