Skip to content

Commit

Permalink
vintConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tacheraSasi committed Dec 14, 2024
1 parent 23aae21 commit 7868cda
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func main() {
case "--docs", "-docs":
repl.Docs()
case "get":
toolkit.Get(os.Args[2])
toolkit.Get(args[2])
case "init":
toolkit.Init()
toolkit.Init(args)
case ".":
// Runs default main.vint file
run("main.vint")
Expand Down
34 changes: 19 additions & 15 deletions toolkit/toolkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
"runtime"
// "strings"
)

var CLI_ARGS []string = []string{}

func GetCliArgs()[]string{// Returns the CLI_ARGS
func GetCliArgs() []string { // Returns the CLI_ARGS
return CLI_ARGS
}

Expand Down Expand Up @@ -188,26 +189,19 @@ func Update() {
fmt.Println("Installation complete!")
}


func Get(pkg string){
func Get(pkg string) {
switch pkg {
case "vintpm":
fmt.Println("Installing vintpm...")
}
}



// Structure for vint.json
var vintConfig = struct {
Name string `json:"name"`
Version string `json:"version"`
}{
Name: "vint-project",
Version: "1.0.0",
type Vint_config struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
}

// Simplified VintLang code for main.vint
const sampleVintCode = `// Simple string manipulation and message printing
// Print a greeting
Expand All @@ -227,7 +221,18 @@ let greet = func(name) {
greet("Developer")`

func init() {
func Init(args []string) {
projectName := "vint-project"
if len(args) >= 2 {
projectName = args[2]
}
// Structure for vint.json
var vintConfig = Vint_config{
Name: projectName,
Version: "1.0.0",
Description: "I love vintLang",
}

// Creating vint.json
vintFile, err := os.Create("vint.json")
if err != nil {
Expand Down Expand Up @@ -257,4 +262,3 @@ func init() {
fmt.Printf("Error writing to main.vint: %v\n", err)
}
}

0 comments on commit 7868cda

Please sign in to comment.