Skip to content

Commit 68f90ea

Browse files
authoredNov 21, 2024
Merge pull request #13 from copilot-extensions/refactor-streamcmd
refactor stream cmd
2 parents eaa71ba + 9470d1f commit 68f90ea

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed
 

‎cmd/rootCmd.go

-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import (
99
)
1010

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

‎cmd/stream.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const (
1515

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

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

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

3337
result, err := stream.ParseFile(file)
3438
if err != nil {

0 commit comments

Comments
 (0)
Failed to load comments.