MCPcopy
hub / github.com/sqlc-dev/sqlc / getConfigPath

Function getConfigPath

internal/cmd/cmd.go:172–193  ·  view source on GitHub ↗
(stderr io.Writer, f *pflag.Flag)

Source from the content-addressed store, hash-verified

170}
171
172func getConfigPath(stderr io.Writer, f *pflag.Flag) (string, string) {
173 if f != nil && f.Changed {
174 file := f.Value.String()
175 if file == "" {
176 fmt.Fprintln(stderr, "error parsing config: file argument is empty")
177 os.Exit(1)
178 }
179 abspath, err := filepath.Abs(file)
180 if err != nil {
181 fmt.Fprintf(stderr, "error parsing config: absolute file path lookup failed: %s\n", err)
182 os.Exit(1)
183 }
184 return filepath.Dir(abspath), filepath.Base(abspath)
185 } else {
186 wd, err := os.Getwd()
187 if err != nil {
188 fmt.Fprintln(stderr, "error parsing sqlc.json: file does not exist")
189 os.Exit(1)
190 }
191 return wd, ""
192 }
193}
194
195var genCmd = &cobra.Command{
196 Use: "generate",

Callers 5

push.goFile · 0.85
cmd.goFile · 0.85
verify.goFile · 0.85
NewCmdVetFunction · 0.85
createdb.goFile · 0.85

Calls 2

AbsMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected