Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ func simulate(sourceFI osabstraction.FileInfo, destinationFI osabstraction.FileI
return fmt.Sprintf("%v", tree), nil
}

func getAbsolutePath(filepath string) (string, error) {
if path.IsAbs(filepath) {
return filepath, nil
}

p, err := os.Getwd()
if err != nil {
return p, err
}

return path.Join(p, filepath), nil
}

func main() {
usage := `flatten.

Expand Down Expand Up @@ -97,6 +110,12 @@ Options:
source = p
} else {
source = src.(string)
var err error
source, err = getAbsolutePath(source)
if err != nil {
fmt.Printf("%v\n", err)
return
}
}

dst := arguments["DESTINATION"]
Expand All @@ -109,6 +128,12 @@ Options:
destination = p
} else {
destination = dst.(string)
var err error
destination, err = getAbsolutePath(destination)
if err != nil {
fmt.Printf("%v\n", err)
return
}
}

verbose := arguments["--verbose"].(bool)
Expand Down