forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command_ext.go
49 lines (41 loc) · 866 Bytes
/
command_ext.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
package commands
import (
"fmt"
"github.com/git-lfs/git-lfs/config"
"github.com/spf13/cobra"
)
func extCommand(cmd *cobra.Command, args []string) {
printAllExts()
}
func extListCommand(cmd *cobra.Command, args []string) {
n := len(args)
if n == 0 {
printAllExts()
return
}
for _, key := range args {
ext := cfg.Extensions()[key]
printExt(ext)
}
}
func printAllExts() {
extensions, err := cfg.SortedExtensions()
if err != nil {
fmt.Println(err)
return
}
for _, ext := range extensions {
printExt(ext)
}
}
func printExt(ext config.Extension) {
Print("Extension: %s", ext.Name)
Print(" clean = %s", ext.Clean)
Print(" smudge = %s", ext.Smudge)
Print(" priority = %d", ext.Priority)
}
func init() {
RegisterCommand("ext", extCommand, func(cmd *cobra.Command) {
cmd.AddCommand(NewCommand("list", extListCommand))
})
}