Skip to content

Commit

Permalink
Chore: Added description to cli commands
Browse files Browse the repository at this point in the history
Former-commit-id: 04b6a1b
  • Loading branch information
MeNsaaH committed Jan 24, 2021
1 parent b2404ad commit fbd02a7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
11 changes: 9 additions & 2 deletions cmd/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 20,8 @@ import (
"os"
"text/template"

"github.com/mensaah/reka/provider/aws"
"github.com/mensaah/reka/provider/gcp"
"github.com/mensaah/reka/provider/types"
"github.com/spf13/cobra"
)
Expand All @@ -43,7 45,7 @@ var markdownTemplate = `
// resourcesCmd represents the resources command
var resourcesCmd = &cobra.Command{
Use: "resources",
Short: "A brief description of your command",
Short: "Shows a list of resources currently supported by reka",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand All @@ -54,7 56,12 @@ to quickly create a Cobra application.`,
type pr struct {
Providers []*types.Provider
}
p := pr{Providers: providers}
p := pr{Providers: []*types.Provider{}}
awsProvider, _ := aws.NewProvider()
gcpProvider, _ := gcp.NewProvider()

p.Providers = append(p.Providers, awsProvider, gcpProvider)

// Create a new template and parse the letter into it.
t := template.Must(template.New("markdown").Parse(markdownTemplate))

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 136,7 @@ func initConfig() {

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
log.Info("Using config file:", viper.ConfigFileUsed())
log.Debug("Using config file:", viper.ConfigFileUsed())
}

if verbose {
Expand Down
15 changes: 13 additions & 2 deletions provider/types/provider.go
Original file line number Diff line number Diff line change
@@ -1,7 1,8 @@
package types

import (
"fmt"
"os"
"path"
"sync"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -32,7 33,17 @@ type Provider struct {

// SetLogger : Sets Logger properties for Provider
func (p *Provider) SetLogger(id string) {
logFile := fmt.Sprintf("%s/%s.log", config.GetConfig().LogPath, id)
workingDir, err := os.Getwd()
if err != nil {
panic(err)
}

logPath := config.GetConfig().LogPath
if logPath == "" {
logPath = path.Join(workingDir, "logs")
}

logFile := path.Join(logPath, id)
// Setup Logger
p.LogPath = logFile
p.Logger = config.GetLogger(p.Name, logFile)
Expand Down

0 comments on commit fbd02a7

Please sign in to comment.