Skip to content

Commit aa2e71e

Browse files
committed
feat(describe): prompt user when no function name provided
1 parent 86062c2 commit aa2e71e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

cmd/describe.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ func runDescribe(cmd *cobra.Command, args []string, newClient ClientFactory) (er
6666
if err != nil {
6767
return
6868
}
69-
// TODO cfg.Prompt()
69+
if err := cfg.Prompt(); err != nil {
70+
return err
71+
}
7072

7173
client, done := newClient(ClientConfig{Verbose: cfg.Verbose})
7274
defer done()
@@ -133,6 +135,21 @@ func newDescribeConfig(cmd *cobra.Command, args []string) (cfg describeConfig, e
133135
return
134136
}
135137

138+
func (c *describeConfig) Prompt() error {
139+
if c.Name == "" && c.Path == "" {
140+
fmt.Print("Enter function name to describe: ")
141+
_,err:= fmt.Scanln(&c.Name)
142+
if err != nil {
143+
return fmt.Errorf("error reading input: %w", err)
144+
}
145+
}
146+
147+
if c.Namespace == "" {
148+
c.Namespace = "default"
149+
}
150+
return nil
151+
}
152+
136153
// Output Formatting (serializers)
137154
// -------------------------------
138155

0 commit comments

Comments
 (0)