Skip to content

Commit

Permalink
feat(cli-client): add routes command
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Chernikov authored and felipejfc committed Apr 23, 2024
1 parent 441a727 commit fc5f542
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 24 additions & 0 deletions pitaya-cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,27 @@ func disconnect() {
pClient.Disconnect()
}
}

func routes(logger Log) error {
if pClient == nil {
return errors.New("client is not initialized")
}

if !pClient.ConnectedStatus() {
return errors.New("not connected")
}

if protoClient, ok := pClient.(*client.ProtoClient); ok {
info := protoClient.ExportInformation()
if info != nil {
for k, _ := range info.Commands {
logger.Println(k)
}
}

} else {
return errors.New("only ProtoClient implements the command `routes`")
}

return nil
}
3 changes: 2 additions & 1 deletion pitaya-cli/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ func executeCommand(logger Log, command string) error {

case "push":
return push(logger, parts[1:])

case "routes":
return routes(logger)
case "disconnect":
disconnect()
return nil
Expand Down

0 comments on commit fc5f542

Please sign in to comment.