Skip to content

Commit d49fd4c

Browse files
committed
Add a warning when there are no contexts
1 parent 95a6537 commit d49fd4c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cmd/context.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ func contextValidArgs(cmd *cobra.Command, args []string, toComplete string) ([]c
3535
return comps, cobra.ShellCompDirectiveNoFileComp
3636
}
3737

38+
if len(contexts) == 0 {
39+
comps = cobra.AppendActiveHelp(comps, "There don't appear to be any contexts defined. Use `sem connect` to configure a context.")
40+
return comps, cobra.ShellCompDirectiveNoFileComp
41+
}
42+
3843
active := config.GetActiveContext()
3944

4045
for _, context := range contexts {

0 commit comments

Comments
 (0)