Skip to content

Commit

Permalink
Adding creation of directory to hold version management
Browse files Browse the repository at this point in the history
  • Loading branch information
simplyzee committed Aug 27, 2019
1 parent ed4f5e7 commit af23a87
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,44 @@ limitations under the License.
*/
package main

import "github.com/zee-ahmed/kubemngr/cmd"
import (
"fmt"
"github.com/zee-ahmed/kubemngr/cmd"
"log"
"os"
)

var clientVersion = "0.0.1"

func main() {

homeDir, err := os.UserHomeDir()
if err != nil {
log.Fatal(err)
}

directory := homeDir + "/.kubemngr"
createDirectory(directory)

cmd.Execute(clientVersion)
}


func createDirectory(dirName string) bool {
src, err := os.Stat(dirName)

if os.IsNotExist(err) {
errDir := os.MkdirAll(dirName, 0755)
if errDir != nil {
panic(err)
}
return true
}

if src.Mode().IsRegular() {
fmt.Println(dirName, "already exist as a file!")
return false
}

return false
}

0 comments on commit af23a87

Please sign in to comment.