Skip to content

Commit

Permalink
refactor: remove MissingCommandText
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Feb 7, 2021
1 parent a3a58fe commit ae10564
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/segment_language.go
Expand Up @@ -81,10 +81,8 @@ const (
DisplayModeEnvironment string = "environment"
// DisplayModeContext displays the segment when the environment or files is active
DisplayModeContext string = "context"
// MissingCommandTextProperty sets the text to display when the command is not present in the system
MissingCommandTextProperty Property = "missing_command_text"
// MissingCommandText displays empty string by default
MissingCommandText string = ""
// MissingCommandText sets the text to display when the command is not present in the system
MissingCommandText Property = "missing_command_text"
)

func (l *language) string() string {
Expand Down Expand Up @@ -152,7 +150,7 @@ func (l *language) setVersion() error {
l.activeCommand = command
return nil
}
return errors.New(l.props.getString(MissingCommandTextProperty, MissingCommandText))
return errors.New(l.props.getString(MissingCommandText, ""))
}

func (l *language) loadLanguageContext() {
Expand Down
4 changes: 2 additions & 2 deletions src/segment_language_test.go
Expand Up @@ -52,7 +52,7 @@ func bootStrapLanguageTest(args *languageArgs) *language {
},
}
if args.missingCommandText != "" {
props.values[MissingCommandTextProperty] = args.missingCommandText
props.values[MissingCommandText] = args.missingCommandText
}
l := &language{
props: props,
Expand All @@ -78,7 +78,7 @@ func TestLanguageFilesFoundButNoCommandAndVersionAndDisplayVersion(t *testing.T)
}
lang := bootStrapLanguageTest(args)
assert.True(t, lang.enabled())
assert.Equal(t, MissingCommandText, lang.string(), "unicorn is not available")
assert.Equal(t, "", lang.string(), "unicorn is not available")
}

func TestLanguageFilesFoundButNoCommandAndVersionAndDontDisplayVersion(t *testing.T) {
Expand Down

0 comments on commit ae10564

Please sign in to comment.