Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
i3going-on
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
i3going-on
Commits
b00fc45c
Unverified
Commit
b00fc45c
authored
2 years ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Clean up error handling.
parent
bf11addd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bar/run.go
+1
-18
1 addition, 18 deletions
bar/run.go
modules/modules.go
+3
-1
3 additions, 1 deletion
modules/modules.go
with
4 additions
and
19 deletions
bar/run.go
+
1
−
18
View file @
b00fc45c
...
@@ -30,24 +30,7 @@ func handleCommands() {
...
@@ -30,24 +30,7 @@ func handleCommands() {
func
Run
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
Run
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
viper
.
BindPFlags
(
cmd
.
Flags
())
viper
.
BindPFlags
(
cmd
.
Flags
())
cfg
,
err
:=
config
.
ReadConfig
(
viper
.
GetString
(
"config"
))
cfg
,
err
:=
config
.
ReadConfig
(
viper
.
GetString
(
"config"
))
if
err
!=
nil
{
// TODO Make a better default
cfg
,
err
=
config
.
ReadConfigStr
(
`---
refresh: 5
modules:
- module: text
name: post
params:
text: "post"
color: "#11ff11"
on-click: xdg-open https://mastodon.ie/
- module: date
params:
format: 06-05-04 15:02
on-click: xdg-open https://calendar.google.com/
`
)
cobra
.
CheckErr
(
err
)
cobra
.
CheckErr
(
err
)
}
if
cfg
.
Refresh
<
1
{
if
cfg
.
Refresh
<
1
{
cfg
.
Refresh
=
5
cfg
.
Refresh
=
5
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/modules.go
+
3
−
1
View file @
b00fc45c
package
modules
package
modules
import
(
import
(
"fmt"
"gopkg.in/yaml.v3"
"gopkg.in/yaml.v3"
)
)
...
@@ -41,7 +43,7 @@ func (m *Module) UnmarshalYAML(node *yaml.Node) error {
...
@@ -41,7 +43,7 @@ func (m *Module) UnmarshalYAML(node *yaml.Node) error {
case
"text"
:
case
"text"
:
m
.
Params
=
NewText
(
m
)
m
.
Params
=
NewText
(
m
)
default
:
default
:
panic
(
"module unknown"
)
return
fmt
.
Errorf
(
"module '%s' is unknown"
,
params
.
Module
)
}
}
return
params
.
Params
.
Decode
(
m
.
Params
)
return
params
.
Params
.
Decode
(
m
.
Params
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment