-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
25 lines (21 loc) · 1.04 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
package main
import (
"github.com/magdyamr542/project-root/src/cmd"
"github.com/magdyamr542/project-root/src/fs"
"github.com/alecthomas/kong"
)
var CLI struct {
Add cmd.AddCmd `cmd:"" help:"Register the given path as the root of the project (can be relative)"`
Ls cmd.LsCmd `cmd:"" help:"List all saved project roots" aliases:"l,ls,list"`
Clear cmd.ClearCmd `cmd:"" help:"clears the database of saved projects. Will delete everything. Use with CAUTION" aliases:"clr"`
Go cmd.GoCmd `cmd:"" help:"go to the root of this project. (can be omitted which means 'pr=pr go')" default:"1"`
Purge cmd.PurgeCmd `cmd:"" help:"delete all registered paths that no longer exist in the file system"`
Back cmd.BackCmd `cmd:"" help:"go back to the place you went to the project root from" aliases:"b"`
To cmd.ToCmd `cmd:"" help:"go to a specific project by using a saved path prefix" aliases:"t"`
}
func main() {
ctx := kong.Parse(&CLI)
ctx.BindTo(fs.DefaultFileSystem, (*fs.FileSystemHandler)(nil))
err := ctx.Run()
ctx.FatalIfErrorf(err)
}