mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
refactor: remove MissingCommandText
This commit is contained in:
parent
a3a58feb0e
commit
ae10564f2b
|
@ -81,10 +81,8 @@ const (
|
||||||
DisplayModeEnvironment string = "environment"
|
DisplayModeEnvironment string = "environment"
|
||||||
// DisplayModeContext displays the segment when the environment or files is active
|
// DisplayModeContext displays the segment when the environment or files is active
|
||||||
DisplayModeContext string = "context"
|
DisplayModeContext string = "context"
|
||||||
// MissingCommandTextProperty sets the text to display when the command is not present in the system
|
// MissingCommandText sets the text to display when the command is not present in the system
|
||||||
MissingCommandTextProperty Property = "missing_command_text"
|
MissingCommandText Property = "missing_command_text"
|
||||||
// MissingCommandText displays empty string by default
|
|
||||||
MissingCommandText string = ""
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (l *language) string() string {
|
func (l *language) string() string {
|
||||||
|
@ -152,7 +150,7 @@ func (l *language) setVersion() error {
|
||||||
l.activeCommand = command
|
l.activeCommand = command
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return errors.New(l.props.getString(MissingCommandTextProperty, MissingCommandText))
|
return errors.New(l.props.getString(MissingCommandText, ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *language) loadLanguageContext() {
|
func (l *language) loadLanguageContext() {
|
||||||
|
|
|
@ -52,7 +52,7 @@ func bootStrapLanguageTest(args *languageArgs) *language {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if args.missingCommandText != "" {
|
if args.missingCommandText != "" {
|
||||||
props.values[MissingCommandTextProperty] = args.missingCommandText
|
props.values[MissingCommandText] = args.missingCommandText
|
||||||
}
|
}
|
||||||
l := &language{
|
l := &language{
|
||||||
props: props,
|
props: props,
|
||||||
|
@ -78,7 +78,7 @@ func TestLanguageFilesFoundButNoCommandAndVersionAndDisplayVersion(t *testing.T)
|
||||||
}
|
}
|
||||||
lang := bootStrapLanguageTest(args)
|
lang := bootStrapLanguageTest(args)
|
||||||
assert.True(t, lang.enabled())
|
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) {
|
func TestLanguageFilesFoundButNoCommandAndVersionAndDontDisplayVersion(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue