This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
81 lines (72 loc) · 1.77 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
import (
"fmt"
"github.com/mreider/agilemarkdown/autocomplete"
"github.com/mreider/agilemarkdown/backlog"
"github.com/mreider/agilemarkdown/commands"
"github.com/mreider/agilemarkdown/git"
"gopkg.in/urfave/cli.v1"
"log"
"math/rand"
"os"
"path/filepath"
"strconv"
"time"
)
var (
version = "0.0.0"
)
func main() {
rootDir, _ := filepath.Abs(".")
gitRootDir := git.GetRootGitDirectory(rootDir)
if gitRootDir != "" {
rootDir = gitRootDir
root := backlog.NewBacklogsStructure(rootDir)
err := commands.AddConfigAndGitIgnore(root)
if err != nil {
fmt.Println(err)
}
backlog.NewUserList(root.UsersDirectory())
}
err := setBashAutoComplete()
if err != nil {
fmt.Printf("can't set bash autocomplete: %v\n", err)
}
rand.Seed(time.Now().Unix())
i, err := strconv.ParseInt(version, 10, 64)
if err == nil {
version = time.Unix(i, 0).UTC().Format("2006.01.02.150405")
}
app := cli.NewApp()
app.Version = version
app.EnableBashCompletion = true
app.Description = "A framework for managing a backlog using Git, Markdown, and YAML"
app.Usage = app.Description
app.Commands = []cli.Command{
commands.CreateBacklogCommand,
commands.CreateItemCommand,
commands.CreateIdeaCommand,
commands.NewSyncCommand(),
commands.WorkCommand,
commands.PointsCommand,
commands.AssignUserCommand,
commands.ChangeStatusCommand,
commands.VelocityCommand,
commands.AliasCommand,
commands.ImportCommand,
commands.ArchiveCommand,
commands.TimelineCommand,
commands.DeleteTagCommand,
commands.ChangeTagCommand,
commands.CreateUserCommand,
commands.DeleteUserCommand,
commands.ChangeUserCommand,
}
err = app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
func setBashAutoComplete() error {
return autocomplete.AddAliasWithBashAutoComplete("")
}