MCPcopy Create free account
hub / github.com/vale-cli/vale / sync

Function sync

cmd/vale/command.go:90–130  ·  view source on GitHub ↗
(_ []string, flags *core.CLIFlags)

Source from the content-addressed store, hash-verified

88}
89
90func sync(_ []string, flags *core.CLIFlags) error {
91 cfg, err := core.ReadPipeline(flags, true)
92 if err != nil {
93 return err
94 } else if err = initPath(cfg); err != nil {
95 return err
96 }
97
98 // NOTE: sync should *only* run for a single config file.
99 rootINI, noRoot := cfg.Root()
100 if noRoot != nil {
101 return core.NewE100("sync", noRoot)
102 }
103
104 pkgs, err := core.GetPackages(rootINI)
105 if err != nil {
106 return err
107 }
108 stylesPath := cfg.StylesPath()
109
110 p, err := pterm.DefaultProgressbar.WithTotal(len(pkgs)).Start()
111 if err != nil {
112 return err
113 }
114
115 for idx, pkg := range pkgs {
116 name := system.FileNameWithoutExt(pkg)
117
118 p.UpdateTitle("Syncing " + name)
119 p.Increment()
120
121 if err = readPkg(pkg, stylesPath, idx); err != nil {
122 return err
123 }
124 }
125
126 msg := fmt.Sprintf("Synced %d package(s) to '%s'.", len(pkgs), stylesPath)
127 pterm.Success.Println(msg)
128
129 return nil
130}
131
132func printConfig(_ []string, flags *core.CLIFlags) error {
133 cfg, err := core.ReadPipeline(flags, false)

Calls 8

ReadPipelineFunction · 0.92
NewE100Function · 0.92
GetPackagesFunction · 0.92
FileNameWithoutExtFunction · 0.92
initPathFunction · 0.85
readPkgFunction · 0.85
RootMethod · 0.80
StylesPathMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…