adding an option to just delete files/folders

This commit is contained in:
2020-07-21 20:37:18 -04:00
parent 08481ec31f
commit a1f816db7a
3 changed files with 19 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ import (
var version = "4.25" //Need to manually set the UEVersion, don't know how to guess this var version = "4.25" //Need to manually set the UEVersion, don't know how to guess this
// RebuildProject is the main function to clean up the project, generate files and build // RebuildProject is the main function to clean up the project, generate files and build
func RebuildProject(riderEnabled bool, doBuild bool) { func RebuildProject(riderEnabled bool, doBuild bool, doRegenerate bool) {
_, err := os.Getwd() _, err := os.Getwd()
if err != nil { if err != nil {
fmt.Println("Unable to get working dir, returned error: ", err) fmt.Println("Unable to get working dir, returned error: ", err)
@@ -54,6 +54,11 @@ func RebuildProject(riderEnabled bool, doBuild bool) {
bufio.NewReader(os.Stdin).ReadBytes('\n') bufio.NewReader(os.Stdin).ReadBytes('\n')
os.Exit(1) os.Exit(1)
} }
if !doRegenerate { //if no need to generated, exit now
fmt.Println("Files/Folders deleted, complete... press <enter> to exit.")
bufio.NewReader(os.Stdin).ReadBytes('\n')
os.Exit(1)
}
// Editing the .uproject file //jsonEdit.go // Editing the .uproject file //jsonEdit.go
err = editProjectFile(projectFile, riderEnabled) err = editProjectFile(projectFile, riderEnabled)
if err != nil { if err != nil {

BIN
main.exe

Binary file not shown.

19
main.go
View File

@@ -24,24 +24,30 @@ func executor(in string) {
switch blocks[1] { switch blocks[1] {
case "--rider": case "--rider":
fmt.Println("Enabling rider plugin when cleaning") fmt.Println("Enabling rider plugin when cleaning")
engine.RebuildProject(true, true) engine.RebuildProject(true, true, true)
} }
} else { } else {
fmt.Println("Cleaning project with default settings...") fmt.Println("Cleaning project with default settings...")
engine.RebuildProject(false, true) engine.RebuildProject(false, true, true)
} }
case "clean": case "create-solution":
if len(blocks) > 1 { if len(blocks) > 1 {
fmt.Println("Flag is: ", blocks[1]) fmt.Println("Flag is: ", blocks[1])
switch blocks[1] { switch blocks[1] {
case "--rider": case "--rider":
fmt.Println("Enabling rider plugin when cleaning") fmt.Println("Enabling rider plugin when cleaning")
engine.RebuildProject(true, false) engine.RebuildProject(true, false, true)
} }
} else { } else {
fmt.Println("Cleaning project with default settings...") fmt.Println("Cleaning project with default settings...")
engine.RebuildProject(false, false) engine.RebuildProject(false, false, true)
} }
case "clean":
if len(blocks) > 1 {
fmt.Println("Command does not accept flags, ignoring flag...")
}
fmt.Println("Cleaning project folders and files")
engine.RebuildProject(false, false, false)
case "help": case "help":
fmt.Println("Use 'clean' or 'rebuild' with the optional flag '--rider' if you need the rider plugin enabled.") fmt.Println("Use 'clean' or 'rebuild' with the optional flag '--rider' if you need the rider plugin enabled.")
fmt.Println("Example Usage: 'clean --rider' or 'rebuild --rider'.") fmt.Println("Example Usage: 'clean --rider' or 'rebuild --rider'.")
@@ -53,7 +59,8 @@ func executor(in string) {
func completer(in prompt.Document) []prompt.Suggest { func completer(in prompt.Document) []prompt.Suggest {
s := []prompt.Suggest{ s := []prompt.Suggest{
{Text: "rebuild", Description: "cleans the project folder and regenerates all files, then builds"}, {Text: "rebuild", Description: "cleans the project folder and regenerates all files, then builds"},
{Text: "clean", Description: "only cleans the project folder and regenerates files, no build"}, {Text: "clean", Description: "only cleans the project folder"},
{Text: "create-solution", Description: "only cleans the project folder and regenerates files, no build"},
{Text: "help", Description: "Shows the help for Unreal Project Manager"}, {Text: "help", Description: "Shows the help for Unreal Project Manager"},
{Text: "exit", Description: "Exit the program"}, {Text: "exit", Description: "Exit the program"},
{Text: "--rider", Description: "FLAG: Enables the rider plugin after 'clean' or 'rebuild'"}, {Text: "--rider", Description: "FLAG: Enables the rider plugin after 'clean' or 'rebuild'"},