Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Keloran committed Sep 28, 2020
1 parent 20de85f commit f77be1b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 36 deletions.
2 changes: 1 addition & 1 deletion apps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (a Apps) brewInstall() error {
return nil
}

func (a Apps) InstallCLI() error {
func (a Apps) Install() error {
if err := xcode(); err != nil {
return fmt.Errorf("cli xcode install: %w", err)
}
Expand Down
5 changes: 0 additions & 5 deletions apps/gui.go

This file was deleted.

9 changes: 7 additions & 2 deletions dots/dots.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package dots
import (
"fmt"

"github.com/Keloran/dotfilesLoader/files"
"github.com/Keloran/dotfilesLoader/console"
"github.com/Keloran/dotfilesLoader/files"
)

type Dots struct {
Expand All @@ -20,6 +21,9 @@ func (d Dots) Install() error {
Name string
}

c := console.NewConsole(false)
c.Start("DotFiles")

if d.Github.Repository != "" {
filesLocation, err := files.Downloader{
GithubDetails: d.Github,
Expand Down Expand Up @@ -56,6 +60,7 @@ func (d Dots) Install() error {
if err = files.Copy(dot.Location, fmt.Sprintf("%s/%s", d.CurrentDir, dot.Name)); err != nil {
return fmt.Errorf("Dotfiles copy: %w", err)
}
c.Info(fmt.Sprintf("%s Copied", dot.Name))
}
}

Expand All @@ -64,6 +69,6 @@ func (d Dots) Install() error {
}
}

fmt.Print("dotfiles installed\n")
c.End("DotFiles")
return nil
}
3 changes: 1 addition & 2 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ func Help() {
BlankLine().
Info("Commands:").
FormattedText(fmt.Sprintf(hFormat, console.Cyan("help"), console.Blue(" This message"))).
FormattedText(fmt.Sprintf(hFormat, console.Cyan("cli"), console.Blue(" Install CLI Apps"))).
FormattedText(fmt.Sprintf(hFormat, console.Cyan("gui"), console.Blue(" Install GUI Apps"))).
FormattedText(fmt.Sprintf(hFormat, console.Cyan("apps"), console.Blue(" Install Apps"))).
FormattedText(fmt.Sprintf(hFormat, console.Cyan("os"), console.Blue(" Install OS Settings"))).
FormattedText(fmt.Sprintf(hFormat, console.Cyan("dots"), console.Blue(" Install the dotfiles"))).
FormattedText(fmt.Sprintf(hFormat, console.Cyan("update"), console.Blue("Run updaters"))).
Expand Down
32 changes: 6 additions & 26 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func main() {
}
}

var dotfiles, appsGUI, appsCLI, OS, all bool
var dotfiles, appsInstall, OS, all bool
help := true
all = true

Expand All @@ -40,12 +40,8 @@ func main() {
dotfiles = true
all = false
help = false
case "gui":
appsGUI = true
all = false
help = false
case "cli":
appsCLI = true
case "apps":
appsInstall = true
help = false
all = false
case "help":
Expand Down Expand Up @@ -93,33 +89,17 @@ func main() {
Skip: *skip,
Github: Github,
}
// GUI
if appsGUI {
// need sudo password
if err := app.SetSudo(); err != nil {
console.NewConsole(false).Error(fmt.Sprintf("Sudo err: %+v", err))
}

// GUI install
fmt.Print("Apps GUI\n")
if err = app.InstallGUI(); err != nil {
console.NewConsole(false).Error(fmt.Sprintf("GUI err: %+v", err))
}

fmt.Print("Apps GUI\n")
return
}

// CLI
if appsCLI {
if appsInstall {
// need sudo password
if err := app.SetSudo(); err != nil {
console.NewConsole(false).Error(fmt.Sprintf("Sudo err: %+v", err))
}

// CLI install
fmt.Print("Apps CLI\n")
if err = app.InstallCLI(); err != nil {
fmt.Print("Apps\n")
if err = app.Install(); err != nil {
console.NewConsole(false).Error(fmt.Sprintf("CLI err: %v", err))
}
return
Expand Down
10 changes: 10 additions & 0 deletions os/os.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package os

type OS struct {
Username string
SudoPassword string
Skip bool
Force bool
}


0 comments on commit f77be1b

Please sign in to comment.