Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit e926236

Browse files
committed
Add new widget remote server to bootstrapping
1 parent ebd5fe9 commit e926236

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

cmd/devdash/config.go

+11
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ type Services struct {
6565
TravisCI TravisCI `mapstructure:"travis"`
6666
Feedly Feedly `mapstructure:"feedly"`
6767
Git Git `mapstructure:"git"`
68+
RemoteHost RemoteHost `mapstructure:"remote_host"`
6869
}
6970

7071
type GoogleAnalytics struct {
@@ -95,6 +96,11 @@ type Feedly struct {
9596
Address string `mapstructure:"address"`
9697
}
9798

99+
type RemoteHost struct {
100+
Username string `mapstructure:"username"`
101+
Address string `mapstructure:"address"`
102+
}
103+
98104
type Git struct {
99105
Path string `mapstructure:"path"`
100106
}
@@ -126,6 +132,10 @@ func (g Git) empty() bool {
126132
return g == Git{}
127133
}
128134

135+
func (g RemoteHost) empty() bool {
136+
return g == RemoteHost{}
137+
}
138+
129139
// OrderWidgets add the widgets to a three dimensional slice.
130140
// First dimension: index of the rows (ir or indexRows).
131141
// Second dimension: index of the columns (ic or indexColumn).
@@ -164,6 +174,7 @@ func mapConfig(data []byte) config {
164174
return cfg
165175
}
166176

177+
// Keyboard events
167178
func (c config) KQuit() string {
168179
if ok := c.General.Keys["quit"]; ok != "" {
169180
return c.General.Keys["quit"]

cmd/devdash/devdash.go

+16-9
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,35 @@ func run(file string, tui *internal.Tui) func() {
130130

131131
travisService := p.Services.TravisCI
132132
if !travisService.empty() {
133-
travisWidget := internal.NewTravisCIWidget(
134-
travisService.Token,
135-
)
133+
travisWidget := internal.NewTravisCIWidget(travisService.Token)
136134
project.WithTravisCI(travisWidget)
137135
}
138136

139137
feedlyService := p.Services.Feedly
140138
if !feedlyService.empty() {
141-
feedlyService := internal.NewFeedlyWidget(
142-
feedlyService.Address,
143-
)
139+
feedlyService := internal.NewFeedlyWidget(feedlyService.Address)
144140
project.WithFeedly(feedlyService)
145141
}
146142

147143
gitService := p.Services.Git
148144
if !gitService.empty() {
149-
gitService := internal.NewGitWidget(
150-
gitService.Path,
151-
)
145+
gitService := internal.NewGitWidget(gitService.Path)
152146
project.WithGit(gitService)
153147
}
154148

149+
remoteHostService := p.Services.RemoteHost
150+
if !remoteHostService.empty() {
151+
remoteHostService, err := internal.NewRemoteHostWidget(
152+
remoteHostService.Username,
153+
remoteHostService.Address,
154+
)
155+
if err != nil {
156+
fmt.Println(err)
157+
internal.DisplayError(tui, err)
158+
}
159+
project.WithRemoteHost(remoteHostService)
160+
}
161+
155162
renderFuncs := project.CreateWidgets()
156163
if !*debug {
157164
project.Render(renderFuncs)

0 commit comments

Comments
 (0)