Skip to content

Commit 10880cf

Browse files
Lukas Kämmerlingthcyron
authored andcommitted
Add flag to configure poll interval
1 parent cacdaa4 commit 10880cf

30 files changed

Lines changed: 256 additions & 70 deletions

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## master
4+
5+
* Add `--poll-interval` flag for controlling the polling interval (for example for action progress updates)
6+
37
## v1.5.0
48

59
* Add `hcloud server ssh` command to open an SSH connection to the server

Gopkg.lock

Lines changed: 39 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cli.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func (c *CLI) Client() *hcloud.Client {
116116
if c.Endpoint != "" {
117117
opts = append(opts, hcloud.WithEndpoint(c.Endpoint))
118118
}
119+
pollInterval, _ := c.RootCommand.PersistentFlags().GetDuration("poll-interval")
120+
if pollInterval > 0 {
121+
opts = append(opts, hcloud.WithPollInterval(pollInterval))
122+
}
119123
c.client = hcloud.NewClient(opts...)
120124
}
121125
return c.client

cli/root.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package cli
22

3-
import "github.com/spf13/cobra"
3+
import (
4+
"time"
5+
6+
"github.com/spf13/cobra"
7+
)
48

59
func NewRootCommand(cli *CLI) *cobra.Command {
610
cmd := &cobra.Command{
@@ -27,7 +31,7 @@ func NewRootCommand(cli *CLI) *cobra.Command {
2731
newLocationCommand(cli),
2832
newISOCommand(cli),
2933
)
30-
34+
cmd.PersistentFlags().Duration("poll-interval", 500*time.Millisecond, "Interval at which to poll information, for example action progress")
3135
return cmd
3236
}
3337

vendor/github.com/hetznercloud/hcloud-go/CHANGES.md

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/hetznercloud/hcloud-go/hcloud/action.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/hetznercloud/hcloud-go/hcloud/action_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/hetznercloud/hcloud-go/hcloud/client.go

Lines changed: 17 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/hetznercloud/hcloud-go/hcloud/client_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/hetznercloud/hcloud-go/hcloud/datacenter_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)