Skip to content

Commit a2f599e

Browse files
feat: Configurable --output flag (#6)
1 parent e604d34 commit a2f599e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

internal/cli/cli.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var (
2424
debug bool
2525
dryRun bool
2626
desiredDefinitions []string
27+
output string
2728
)
2829

2930
func init() {
@@ -34,6 +35,7 @@ func init() {
3435
rootCmd.PersistentFlags().BoolVarP(&dryRun, "dry-run", "", false, "dry run")
3536

3637
pick.Flags().StringSliceVarP(&desiredDefinitions, "definitions", "d", []string{}, "definitions from the SDL you want to pick/keep")
38+
pick.Flags().StringVarP(&output, "output", "o", "", "where the resulting schema/SDL file is written")
3739
}
3840

3941
func Main() {

internal/cli/print.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ func printSDL(doc *ast.Document) {
1212
log.Infof("Printing new SDL to file with %d definitions", len(doc.Definitions))
1313

1414
// Create a new file where we'll write the new SDL
15-
// TODO make configurable
16-
f, err := os.Create("output.sdl.graphqls")
15+
f, err := os.Create(output)
1716
if err != nil {
1817
log.Fatal("unable to create new SDL file for writing", "err", err)
1918
}

0 commit comments

Comments
 (0)