Merge pull request #33 from albertdev/bugfix/platform-indedependent-homedir
Use platform independent os.UserHomeDir() function
This commit is contained in:
commit
72ff78498b
@ -28,6 +28,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -50,7 +51,7 @@ func usage() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
taskName := flag.String("task", "default", "name of task to execute")
|
taskName := flag.String("task", "default", "name of task to execute")
|
||||||
dstDir := flag.String("dest", os.Getenv("HOME"), "target directory for tasks")
|
dstDir := flag.String("dest", "", "target directory for tasks")
|
||||||
force := flag.Bool("force", true, "create parent directories to target")
|
force := flag.Bool("force", true, "create parent directories to target")
|
||||||
clobber := flag.Bool("clobber", false, "delete files and directories at target")
|
clobber := flag.Bool("clobber", false, "delete files and directories at target")
|
||||||
verbose := flag.Bool("verbose", false, "verbose output")
|
verbose := flag.Bool("verbose", false, "verbose output")
|
||||||
@ -94,6 +95,10 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.TrimSpace(*dstDir) == "" {
|
||||||
|
*dstDir, _ = os.UserHomeDir()
|
||||||
|
}
|
||||||
|
|
||||||
conf.srcDir = makeAbsPath(flag.Arg(1))
|
conf.srcDir = makeAbsPath(flag.Arg(1))
|
||||||
conf.dstDir = makeAbsPath(*dstDir)
|
conf.dstDir = makeAbsPath(*dstDir)
|
||||||
conf.variant = *variant
|
conf.variant = *variant
|
||||||
|
Loading…
Reference in New Issue
Block a user