Debian Codegraph @

commands/command_ext.go

raw symbols SCIP
1 package commands
2
3 import (
4 "fmt"
5
6 "github.com/git-lfs/git-lfs/v3/config"
7 "github.com/git-lfs/git-lfs/v3/tr"
8 "github.com/spf13/cobra"
9 )
10
11 func extCommand(cmd *cobra.Command, args []string) {
12 printAllExts()
13 }
14
15 func extListCommand(cmd *cobra.Command, args []string) {
16 n := len(args)
17 if n == 0 {
18 printAllExts()
19 return
20 }
21
22 for _, key := range args {
23 ext := cfg.Extensions()[key]
24 printExt(ext)
25 }
26 }
27
28 func printAllExts() {
29 extensions, err := cfg.SortedExtensions()
30 if err != nil {
31 fmt.Println(err)
32 return
33 }
34 for _, ext := range extensions {
35 printExt(ext)
36 }
37 }
38
39 func printExt(ext config.Extension) {
40 Print(tr.Tr.Get("Extension: %s", ext.Name))
41 Print(` clean = %s
42 smudge = %s
43 priority = %d`, ext.Clean, ext.Smudge, ext.Priority)
44 }
45
46 func init() {
47 RegisterCommand("ext", extCommand, func(cmd *cobra.Command) {
48 cmd.AddCommand(NewCommand("list", extListCommand))
49 })
50 }