#118 fixed
This commit is contained in:
parent
b98f93706e
commit
369215a8f1
23
cmd.go
23
cmd.go
|
@ -9,12 +9,9 @@ import (
|
||||||
|
|
||||||
// Tool options customizable, should be moved in Cmd
|
// Tool options customizable, should be moved in Cmd
|
||||||
type tool struct {
|
type tool struct {
|
||||||
dir bool
|
dir, status bool
|
||||||
status bool
|
name, err string
|
||||||
name string
|
cmd, options []string
|
||||||
err string
|
|
||||||
cmd []string
|
|
||||||
options []string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cmds list of go commands
|
// Cmds list of go commands
|
||||||
|
@ -56,13 +53,21 @@ func (r *realize) clean() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new project
|
// Add a new project
|
||||||
func (r *realize) add(p *cli.Context) error {
|
func (r *realize) add(p *cli.Context) (err error) {
|
||||||
path, err := filepath.Abs(p.String("path"))
|
var path string
|
||||||
|
// #118 get relative and if not exist try to get abs
|
||||||
|
if _, err = os.Stat(p.String("path")); os.IsNotExist(err) {
|
||||||
|
// path doesn't exist
|
||||||
|
path, err = filepath.Abs(p.String("path"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
path = filepath.Clean(p.String("path"))
|
||||||
|
}
|
||||||
|
|
||||||
project := Project{
|
project := Project{
|
||||||
Name: filepath.Base(filepath.Clean(p.String("path"))),
|
Name: filepath.Base(wdir()),
|
||||||
Path: path,
|
Path: path,
|
||||||
Cmds: Cmds{
|
Cmds: Cmds{
|
||||||
Vet: Cmd{
|
Vet: Cmd{
|
||||||
|
|
Loading…
Reference in New Issue