Last change
on this file since 71 was 71, checked in by Izuru Yakumo, 8 months ago |
Add txt-init program
Signed-off-by: Izuru Yakumo <yakumo.izuru@…>
|
File size:
913 bytes
|
Line | |
---|
1 | package main
|
---|
2 |
|
---|
3 | import (
|
---|
4 | "fmt"
|
---|
5 | "os"
|
---|
6 | )
|
---|
7 |
|
---|
8 | var (
|
---|
9 | authors string
|
---|
10 | id string
|
---|
11 | title string
|
---|
12 | )
|
---|
13 |
|
---|
14 | func main() {
|
---|
15 | fmt.Print("Name of the repository: ")
|
---|
16 | fmt.Scanln(&title)
|
---|
17 | fmt.Print("Base32 unique identifier (must be 6 characters long): ")
|
---|
18 | fmt.Scanln(&id)
|
---|
19 | fmt.Print("Authors (addresses in the <protocol:name@example.com> format: ")
|
---|
20 | fmt.Scanln(&authors)
|
---|
21 |
|
---|
22 | f, err := os.Create("./txt.conf")
|
---|
23 | if err != nil {
|
---|
24 | fmt.Println("Error creating txt.conf")
|
---|
25 | os.Exit(1)
|
---|
26 | }
|
---|
27 | defer f.Close()
|
---|
28 |
|
---|
29 | pwd, err := os.Getwd()
|
---|
30 | if err != nil {
|
---|
31 | fmt.Println("Unable to get working directory")
|
---|
32 | os.Exit(1)
|
---|
33 | }
|
---|
34 |
|
---|
35 | f.WriteString("Id: " + fmt.Sprint(id) + "\n")
|
---|
36 | f.WriteString("Title: " + fmt.Sprint(title) + "\n")
|
---|
37 | f.WriteString("Authors: " + fmt.Sprint(authors) + "\n")
|
---|
38 |
|
---|
39 | fmt.Println("All done!")
|
---|
40 | fmt.Println("Configuration file written to txt.conf")
|
---|
41 | fmt.Println("Read the documentation in Logarion's repository")
|
---|
42 | fmt.Printf("%v\n", pwd)
|
---|
43 | }
|
---|
44 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.