Skip to content

Commit

Permalink
Merge pull request #13 from copilot-extensions/refactor-streamcmd
Browse files Browse the repository at this point in the history
refactor stream cmd
  • Loading branch information
calvinmvrk authored Nov 21, 2024
2 parents eaa71ba + 9470d1f commit 68f90ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions cmd/rootCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import (
)

var rootCmd = &cobra.Command{
Use: "gh-debug-cli",
Short: "A CLI tool for debugging",
Long: `This CLI tool allows you to debug your agent by chatting with it locally.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Use 'gh-debug-cli --help' to see available commands")
},
}

Expand Down
12 changes: 8 additions & 4 deletions cmd/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const (

// streamCmd represents the new command for streaming functionality
var streamCmd = &cobra.Command{
Use: "stream [file]",
Short: "Stream data to your agent",
Long: `The stream command allows you to initiate a data stream to your agent.`,
Use: "stream --file [filename]",
Short: "Parse stream data from agent",
Long: `Allows you to parse a data stream to your agent response.`,
Run: agentStream,
}

Expand All @@ -28,7 +28,11 @@ func init() {
func agentStream(cmd *cobra.Command, args []string) {
fmt.Println("stream command executed successfully")

file := args[0]
file, _ := cmd.Flags().GetString(streamCmdFileFlag)
if file == "" {
fmt.Fprintln(os.Stderr, "Error: --file [file] is required")
os.Exit(1)
}

result, err := stream.ParseFile(file)
if err != nil {
Expand Down

0 comments on commit 68f90ea

Please sign in to comment.