Skip to content

Commit

Permalink
prompt when listing configs should show number range.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Apr 23, 2018
1 parent 3241ebc commit e7c1a27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -154,8 +154,7 @@ Rendered Drawbridge Configs:
├── [9] shard_type: idle, username: aws
└── [10] shard_type: live, username: aws
Enter number of drawbridge config you would like to connect to:
Enter number of drawbridge config you would like to connect to (1-10):
```

`drawbridge connect` will connect you to the bastion/jump host using a specified Drawbridge config file. It'll also add
Expand All @@ -168,6 +167,7 @@ If you want to connect directly to a internal server, you can do so by specifyin
## Delete

`drawbridge delete`
`drawbridge delete --all --force`


## Update
Expand Down
13 changes: 10 additions & 3 deletions cmd/drawbridge/drawbridge.go
Expand Up @@ -108,12 +108,16 @@ func main() {
listAction := actions.ListAction{Config: config}
listAction.Start()

if len(listAction.OrderedAnswers) == 0 {
return nil
}

var answerIndex int

if c.IsSet("drawbridge_id") {
answerIndex = c.Int("drawbridge_id")
} else {
text := utils.StdinQuery("Enter number of drawbridge config you would like to connect to:")
text := utils.StdinQuery(fmt.Sprintf("Enter number of drawbridge config you would like to connect to (%v-%v):", 1, len(listAction.OrderedAnswers) ))
i, err := strconv.Atoi(text)
if err != nil {
return err
Expand Down Expand Up @@ -165,7 +169,9 @@ func main() {
if c.IsSet("drawbridge_id") {
answerIndex = c.Int("drawbridge_id")
} else {
text := utils.StdinQuery("Enter number of drawbridge config you would like to download from:")


text := utils.StdinQuery(fmt.Sprintf("Enter number of drawbridge config you would like to download from (%v-%v):", 1, len(listAction.OrderedAnswers)))
i, err := strconv.Atoi(text)
if err != nil {
return err
Expand Down Expand Up @@ -213,7 +219,8 @@ func main() {
if c.IsSet("drawbridge_id") {
answerIndex = c.Int("drawbridge_id")
} else {
text := utils.StdinQuery("Enter number of drawbridge config you would like to delete:")

text := utils.StdinQuery(fmt.Sprintf("Enter number of drawbridge config you would like to delete (%v-%v):", 1, len(listAction.OrderedAnswers)))
i, err := strconv.Atoi(text)
if err != nil {
return err
Expand Down

0 comments on commit e7c1a27

Please sign in to comment.