github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/main.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package main
     4  
     5  import (
     6  	"flag"
     7  	"fmt"
     8  	"os"
     9  	"time"
    10  	// libgo "./services"
    11  )
    12  
    13  func main() {
    14  	var start = time.Now()
    15  
    16  	var serviceName string
    17  	if len(os.Args) > 1 {
    18  		serviceName = os.Args[1]
    19  	}
    20  
    21  	// https://wails.app/reference/cli/
    22  	switch serviceName {
    23  	case "":
    24  		helpMessage()
    25  		os.Exit(2)
    26  	case "version":
    27  		fmt.Println("Version:", version, `
    28  You may help us and create issue:
    29  https://github.com/GeniusesGroup/libgo/issues/new
    30  For more information, see:
    31  https://github.com/GeniusesGroup/libgo/`)
    32  		os.Exit(0)
    33  	case "help":
    34  		helpMessage()
    35  		os.Exit(0)
    36  	case "update":
    37  		// TODO::: update libgo
    38  	case "interactive":
    39  		// TODO::: cli interactive mode
    40  	case "new": // || "init" || "create"
    41  		// TODO::: make new project by tempelate address e.g. github url or defaults one:
    42  		// - raw(with little predefined codes)
    43  		// - society(government)
    44  		// - org(organization)
    45  		// - aggregator-org
    46  		// - game(or sub type of org??)
    47  		// Ask version control: libgo || git
    48  
    49  		// # Make new project base on libgo with git as version control
    50  		// # - Initialize new project by `git init`
    51  		// # - Clone exiting repo by `git clone ${repository path}`.
    52  		// # - Add libgo to project as submodule by `git submodule add -b master https://github.com/GeniusesGroup/libgo`
    53  		// #  `//go:generate libgo -destination=../mock.go -package=store_mock  -self_package=github.com// github.com/// UserStore`
    54  	case "build":
    55  		// TODO::: generate and build new project as OS image(Unikernel) can run on PersiaOS, KVM, XEN, ...
    56  	case "deploy":
    57  		// TODO::: build and deploy new project to a first server just if it is new project by not raw template
    58  	case "init":
    59  		// TODO:::
    60  	case "issue":
    61  		// TODO::: This command speeds up the process for submitting an issue
    62  	case "generate":
    63  		// TODO::: run generators on the projects without build
    64  	case "gui":
    65  		// TODO::: GUI services like make new page
    66  	case "???":
    67  		// libgo.CompleteJson()
    68  		//go:generate libgo -service=complete-json -force_update -destination=../service.go -package=services
    69  		//go:generate libgo -service=gui -os ios -certificate "Apple Distribution" -profile "My App" -appID "com.example.myapp"
    70  	default:
    71  		fmt.Fprintf(os.Stderr, "libgo %s: unknown command\nRun 'libgo help' for usage.\n", serviceName)
    72  		os.Exit(2)
    73  	}
    74  
    75  	fmt.Println("*************************************** Libgo ***************************************")
    76  	fmt.Println("Version: ", version)
    77  	fmt.Println("Start at: ", start)
    78  	fmt.Println("Running duration: ", time.Since(start))
    79  	fmt.Println("See you soon!")
    80  	fmt.Println("-------------------------------------------------------------------------------------")
    81  }
    82  
    83  func helpMessage() {
    84  	fmt.Fprintf(flag.CommandLine.Output(), "Libgo is a tool to develope software in Go by the full details Geniuses.Group architecture\n\n")
    85  	fmt.Printf("If no command is provided %s will start the runner with the provided flags\n\n", os.Args[0])
    86  	fmt.Println("Commands:")
    87  	fmt.Println("	init	creates")
    88  
    89  	fmt.Println("Flags:")
    90  	flag.PrintDefaults()
    91  }