Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme generator #342

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Readme-Generator/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module readme

go 1.21.2
62 changes: 62 additions & 0 deletions Readme-Generator/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package main

import (
"bufio"
"fmt"
"os"
)

type Project struct {
Title string
Description string
Install string
Usage string
Dependencies string
Contributors string
}

func main() {
var project = Project{}
fmt.Println("Veuillez entrer les informations du projet :")
scanner := bufio.NewScanner(os.Stdin)

fmt.Print("Titre : ")
scanner.Scan()
project.Title = scanner.Text()

fmt.Print("Description : ")
scanner.Scan()
project.Description = scanner.Text()

fmt.Print("Installation : ")
scanner.Scan()
project.Install = scanner.Text()

fmt.Print("Usage : ")
scanner.Scan()
project.Usage = scanner.Text()

fmt.Print("Dépendances : ")
scanner.Scan()
project.Dependencies = scanner.Text()

fmt.Print("Contributeurs : ")
scanner.Scan()
project.Contributors = scanner.Text()

file, err := os.Create("README.md")
if err != nil {
fmt.Println(err)
return
}
defer file.Close()

fmt.Fprintf(file, "# %s\n\n", project.Title)
fmt.Fprintf(file, "%s\n\n", project.Description)
fmt.Fprintf(file, "## Installation\n\n```bash\n%s\n\n```\n\n\n", project.Install)
fmt.Fprintf(file, "## Usage \n\n\n%s\n\n", project.Usage)
fmt.Fprintf(file, "## Dépendances\n\n%s\n\n", project.Dependencies)
fmt.Fprintf(file, "## Contributeurs\n\n%s\n", project.Contributors)

fmt.Println("README.md créé avec succès.")
}