refactor: remove MissingCommandText

This commit is contained in:
Jan De Dobbeleer 2021-02-06 18:13:20 +01:00 committed by Jan De Dobbeleer
parent a3a58feb0e
commit ae10564f2b
2 changed files with 5 additions and 7 deletions

View file

@ -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 {
@ -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() {

View file

@ -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,
@ -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) {