2015-07-10 20:54:06 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2016-11-15 17:01:18 +00:00
|
|
|
"github.com/git-lfs/git-lfs/config"
|
2016-05-23 18:02:27 +00:00
|
|
|
"github.com/spf13/cobra"
|
2015-07-10 20:54:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func extCommand(cmd *cobra.Command, args []string) {
|
|
|
|
printAllExts()
|
|
|
|
}
|
|
|
|
|
|
|
|
func extListCommand(cmd *cobra.Command, args []string) {
|
|
|
|
n := len(args)
|
|
|
|
if n == 0 {
|
|
|
|
printAllExts()
|
2015-07-24 04:53:36 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, key := range args {
|
2016-07-21 22:37:53 +00:00
|
|
|
ext := cfg.Extensions()[key]
|
2015-07-24 04:53:36 +00:00
|
|
|
printExt(ext)
|
2015-07-10 20:54:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func printAllExts() {
|
2016-07-21 22:37:53 +00:00
|
|
|
extensions, err := cfg.SortedExtensions()
|
2015-07-10 20:54:06 +00:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
for _, ext := range extensions {
|
|
|
|
printExt(ext)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-13 16:43:04 +00:00
|
|
|
func printExt(ext config.Extension) {
|
2015-07-10 20:54:06 +00:00
|
|
|
Print("Extension: %s", ext.Name)
|
|
|
|
Print(" clean = %s", ext.Clean)
|
|
|
|
Print(" smudge = %s", ext.Smudge)
|
|
|
|
Print(" priority = %d", ext.Priority)
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-09-01 16:09:38 +00:00
|
|
|
RegisterCommand("ext", extCommand, func(cmd *cobra.Command) {
|
2016-09-01 14:46:26 +00:00
|
|
|
cmd.AddCommand(NewCommand("list", extListCommand))
|
2016-08-10 15:33:25 +00:00
|
|
|
})
|
2015-07-10 20:54:06 +00:00
|
|
|
}
|