File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ import (
1010// Pull data for icon from GitHub into ~/.config/icon-data.
1111func data (cmd * cobra.Command , args []string ) {
1212 dir := "~/.config/icon-data"
13+ if ! utils .GetBoolFlag (cmd , "force" ) && utils .ExistsDir (dir + "/.git" ) {
14+ fmt .Println ("Using existing data in ~/.config/icon-data." )
15+ return
16+ }
17+
1318 utils .BackupDir (dir , "" )
1419 utils .MkdirAll (dir , 0o700 )
1520
@@ -31,5 +36,6 @@ var dataCmd = &cobra.Command{
3136
3237func init () {
3338 dataCmd .
Flags ().
StringP (
"git-url" ,
"g" ,
"[email protected] :legendu-net/icon-data.git" ,
"The Git repo URL for icon-data." )
39+ dataCmd .Flags ().Bool ("force" , false , "Force pulling data if it alreay exists." )
3440 rootCmd .AddCommand (dataCmd )
3541}
Original file line number Diff line number Diff line change @@ -527,7 +527,7 @@ func ExistsPath(path string) bool {
527527// @example
528528// if ExistsDir("/tmp/mydir") { ... }
529529func ExistsDir (path string ) bool {
530- stat , err := os .Stat (path )
530+ stat , err := os .Stat (NormalizePath ( path ) )
531531 if os .IsNotExist (err ) {
532532 return false
533533 }
You can’t perform that action at this time.
0 commit comments