Skip to content

Commit

Permalink
add SetStringVersion to simplify the version setting
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed Jun 13, 2019
1 parent 723c299 commit ce8ed32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ func (c *Config) AllGroups() []*OptGroup {
return groups
}

// SetStringVersion is equal to c.SetVersion(VersionOpt.D(version)).
func (c *Config) SetStringVersion(version string) {
c.SetVersion(VersionOpt.D(version))
}

// SetVersion sets the version information.
//
// Notice: the field Default must be a string.
Expand Down
5 changes: 5 additions & 0 deletions global.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func SetVersion(version Opt) {
Conf.SetVersion(version)
}

// SetStringVersion is equal to Conf.SetStringVersion(version).
func SetStringVersion(version string) {
Conf.SetStringVersion(version)
}

// AddWatcher is equal to Conf.AddWatcher(watchers...).
func AddWatcher(watchers ...Watcher) {
Conf.AddWatcher(watchers...)
Expand Down

0 comments on commit ce8ed32

Please sign in to comment.