Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Jul 21, 2023
1 parent 2b16d31 commit 8917168
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -43,8 +44,6 @@ func newRootCmd(version string) *cobra.Command {
cmd.PersistentFlags().StringVarP(&globalOpts.prompt, "prompt", "p", "", "prompt to use (required)")
cmd.PersistentFlags().StringVarP(&globalOpts.outdir, "outdir", "o", "dist", "outdir to use")

_ = cmd.MarkPersistentFlagRequired("prompt")

cmd.AddCommand(
newAnthropicCmd(globalOpts),
newOpenAICmd(globalOpts),
Expand All @@ -60,6 +59,10 @@ func run(ctx context.Context, globalOpts *globalOptions, cg codegen.CodeGen) err
return err
}

if prompt == "" {
return errors.New("prompt is required")
}

fmt.Println("Create list of files:")

fpOutput, err := cg.FilePaths(ctx, &codegen.FilePathsInput{
Expand Down

0 comments on commit 8917168

Please sign in to comment.