File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 11package cmd
22
33import (
4- "os"
5- "path"
6-
74 "github.com/openshift-knative/deviate/pkg/cli"
85 "github.com/openshift-knative/deviate/pkg/metadata"
96 "github.com/spf13/cobra"
107)
118
129func addFlags (root * cobra.Command , opts * cli.Options ) {
1310 fl := root .PersistentFlags ()
14- wd , err := os .Getwd ()
15- if err != nil {
16- panic (err )
17- }
18- config := path .Join (wd , ".deviate.yaml" )
19- fl .StringVar (& opts .ConfigPath , "config" , config ,
11+ fl .StringVar (& opts .ConfigPath , "config" , ".deviate.yaml" ,
2012 metadata .Name + " configuration file" )
2113}
Original file line number Diff line number Diff line change 11package cmd
22
33import (
4+ "os"
45 "path"
56
67 "github.com/openshift-knative/deviate/pkg/cli"
@@ -29,9 +30,17 @@ func (s sync) run(cmd *cobra.Command, args []string) error {
2930
3031func (s sync ) project (args []string ) func () config.Project {
3132 return func () config.Project {
33+ configPath := s .ConfigPath
34+ wd , err := os .Getwd ()
35+ if err != nil {
36+ wd = "/"
37+ }
38+ if ! path .IsAbs (configPath ) {
39+ configPath = path .Join (wd , configPath )
40+ }
3241 project := config.Project {
33- ConfigPath : s . ConfigPath ,
34- Path : path . Dir ( s . ConfigPath ) ,
42+ ConfigPath : configPath ,
43+ Path : wd ,
3544 }
3645 if len (args ) > 0 {
3746 project .Path = args [0 ]
You can’t perform that action at this time.
0 commit comments